Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/208.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用intellij idea构建android应用程序找不到主题AppCompat.Light_Android_Intellij Idea - Fatal编程技术网

使用intellij idea构建android应用程序找不到主题AppCompat.Light

使用intellij idea构建android应用程序找不到主题AppCompat.Light,android,intellij-idea,Android,Intellij Idea,现在我正试图用这个来构建这个android应用程序。但是当我添加下面的示例代码时,我得到了一个错误 <activity android:name="MyActivity" android:label="@string/app_name" android:theme="@style/Theme.AppCompat.Light"> 我在互联网上试过很多帖子,但没有找到使用intellij idea的解决方案 我所有的代码都在这里,但我认为这不是问题所在,一定是我

现在我正试图用这个来构建这个android应用程序。但是当我添加下面的示例代码时,我得到了一个错误

<activity android:name="MyActivity"
      android:label="@string/app_name"
      android:theme="@style/Theme.AppCompat.Light">
我在互联网上试过很多帖子,但没有找到使用intellij idea的解决方案

我所有的代码都在这里,但我认为这不是问题所在,一定是我忘记使用idea配置的东西:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.example.androidtwo"
          android:versionCode="1"
          android:versionName="1.0">
    <uses-sdk android:minSdkVersion="7"  android:targetSdkVersion="18" />

    <application android:label="@string/app_name"
                 android:icon="@drawable/ic_launcher">
        <activity android:name="MyActivity"
                  android:label="@string/app_name"
                  android:theme="@style/Theme.AppCompat.Light">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>
</manifest>

build.gradle必须包含以下行:

compile 'com.android.support:appcompat-v7:19.1.0'

我没有使用gradle,但我已经导入了appcompat依赖项,并将其作为项目中的一个模块。您是如何添加依赖项的?我想这是你的问题。您必须将其添加为库项目,而不仅仅是像jaryes那样的类。我将其添加为库。首先,我将appcompat项目作为一个模块导入,然后将libs dir中的jar文件作为一个库。还有什么我应该做的吗?是的-这是你的问题-jar不包含样式-只是逻辑类-你需要将其作为库项目添加-也许可以考虑使用gradle-这种方式非常简单,我可以在哪里搜索gradle依赖项?我知道maven有一个网站search.maven.org
package com.example.androidtwo;

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;

public class MyActivity extends ActionBarActivity {
    /**
     * Called when the activity is first created.
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}
compile 'com.android.support:appcompat-v7:19.1.0'