无法在Android工作室上运行App

时间:2015-09-22 16:11:35

标签: android android-studio gradle android-manifest android-theme

当我在android studio中创建一个新项目时,我发现活动类最初扩展了AppCompatActivity,我必须将其更改为扩展 而不是活动。

但我遇到的问题是,R类无法识别,我收到错误"无法解析符号R"。我发布了build.gradle 文件如下,在我看来它没有错误。

此外,在试图找出解决方案之后,我检查了所有的xml文件,我发现了style.xml"发布在"错误在" Theme.AppCompat.Light.DarkActionBar" 和android studio无法解决它。

请告诉我如何解决此错误。

:     公共类MainActivity扩展了Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.xxx.xxx);//cant resolve symbol R
    }
}

style.xml :     

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">//cant resolve symbol Theme+cant resolve symbol AppCompat
        <!-- Customize your theme here. -->
    </style>

</resources>

gradle.build

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.example.com.bt_11"
        minSdkVersion 19
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.+'
}

0 个答案:

没有答案