Android studio Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'

感情迁移 提交于 2019-12-22 11:07:35

问题


I am a beginner in android studio, i have started creating the app named Hello World but always in the gradle build tab, its shows 2 errors. The errors i face are:

Error:(1) Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.

Error:Execution failed for task ':app:processDebugResources'.> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'e:\Program Files\Android\sdk\build-tools\22.0.1\aapt.exe'' finished with non-zero exit value 1

This is my build.gradle

apply plugin: 'com.android.application'
android {
    compileSdkVersion 22
    buildToolsVersion '22.0.1'

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

What should i do now to run my program without errors, please help me........


回答1:


theme "Theme.AppCompat.Light.DarkActionBar" is declared in modul "com.android.support:appcompat-v7"

so you need something like this in your build.gradle.

dependencies {
    compile 'com.android.support:appcompat-v7:22.1.1'
}

alternativly you can use "Theme.Holo.Light.DarkActionBar" instead which is part of newer android versions and does not need an extra modul.

"Theme.AppCompat.xxx" and "com.android.support:appcompat-v7" was created to allow old android versions like android-2.2 to user newer features introduced in newer android versions.



来源:https://stackoverflow.com/questions/30616816/android-studio-error-retrieving-parent-for-item-no-resource-found-that-matches

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!