Android Studio检索项目的父项时出错:找不到与给定名称'Theme.AppCompat.Light.DarkActionBar'匹配的资源
我是android studio的初学者,我已经开始创建名为Hello World的应用,但始终在gradle build选项卡中,它显示2个错误.我遇到的错误是:
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:
错误:(1)检索项目的父项时出错:未找到与给定名称'Theme.AppCompat.Light.DarkActionBar'匹配的资源.
Error:(1) Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
错误:任务':app:processDebugResources'的执行失败.> com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:处理'command'e:\ Program Files \ Android \ sdk \ build-tools \ 22.0.1 \ aapt.exe''以非零退出值1完成
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
这是我的build.gradle
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........
主题"Mod.com.android.support:appcompat-v7"中声明了主题"Theme.AppCompat.Light.DarkActionBar"
theme "Theme.AppCompat.Light.DarkActionBar" is declared in modul "com.android.support:appcompat-v7"
所以您在build.gradle中需要这样的东西.
so you need something like this in your build.gradle.
dependencies {
compile 'com.android.support:appcompat-v7:22.1.1'
}
或者,您可以改用"Theme.Holo.Light.DarkActionBar",它是较新的android版本的一部分,不需要额外的模块.
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"和"com.android.support:appcompat-v7",以允许较旧的android版本(如android-2.2)使用较新的android版本中引入的较新功能.
"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.