您的位置:首页 > 移动开发 > Android开发

No resource found that matches the given name 'android:Theme.Material.Light.DarkActionBar'.

2015-10-06 10:40 911 查看
我试着改变我 HelloWorld
Application
Material.Light.DarkActionBar 主题的全息主题 (所说是什么新的
Android
开发工具会话)。但我得到了以下错误。我试着改变目标 SDK 版本是 21。但我们没有 21 SDK SDK 管理器中。在该届会议上,他们说,设置样式
xml

v-21。

values/styles.xml
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>

</resources>


值-v21/styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>

!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Material.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
</resources>


build.gradle
apply plugin: 'com.android.application'

android {
compileSdkVersion 20
buildToolsVersion "20.0.0"

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

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}


错误:
Error:Error retrieving parent for item:
No resource found that matches the given name 'android:Theme.Material.Light.DarkActionBar'.
Error:Execution failed for task ':app:processDebugResources'.> com.android.ide.common.internal.LoggedErrorException: Failed to run command: /Applications/Android Studio.app/sdk/build-tools/android-4.4W/aapt package -f --no-crunch -I /Applications/Android Studio.app/sdk/platforms/android-20/android.jar -M /Users/Ram_PC/Ram/MyDrive/My_Workspaces/Android_Studio_Workspace_L/HelloWorld/app/build/intermediates/manifests/debug/AndroidManifest.xml -S /Users/Ram_PC/Ram/MyDrive/My_Workspaces/Android_Studio_Workspace_L/HelloWorld/app/build/intermediates/res/debug -A /Users/Ram_PC/Ram/MyDrive/My_Workspaces/Android_Studio_Workspace_L/HelloWorld/app/build/intermediates/assets/debug -m -J /Users/Ram_PC/Ram/MyDrive/My_Workspaces/Android_Studio_Workspace_L/HelloWorld/app/build/generated/source/r/debug -F /Users/Ram_PC/Ram/MyDrive/My_Workspaces/Android_Studio_Workspace_L/HelloWorld/app/build/intermediates/libs/app-debug.ap_ --debug-mode --custom-package com.ramapps.helloworld -0 apk Error Code: 1 Output: /Users/Ram_PC/Ram/MyDrive/My_Workspaces/Android_Studio_Workspace_L/HelloWorld/app/build/intermediates/res/debug/values-v21/values.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light.DarkActionBar'.


解决方法 1:

你可以试着在中设置的值
build.gradle
像这样:
android {
compileSdkVersion 'android-L'
buildToolsVersion '20.0.0'
defaultConfig {
minSdkVersion 'L'
targetSdkVersion 'L'
versionCode 1
versionName '1.0'
}
}

主要是因为编译sdk的版本太低,最好是22以上
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: