Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I try to change my HelloWorld Application holo theme to Material.Light.DarkActionBar theme(As said by What's new Android Development tools session). But I got following error. I try to change target SDK version is 21. But We didn't have 21 SDK in SDK Manager. In that session,they said,set style xml for v-21.

values/styles.xml

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

values-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: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'. 
like image 712
Ramprasad Avatar asked Jul 02 '14 11:07

Ramprasad


2 Answers

You can try to set the values in the build.gradle like this (updated for API 25):

android {   compileSdkVersion 25   buildToolsVersion "25.0.3"   defaultConfig {     minSdkVersion 21 //oldest version you would like to support     targetSdkVersion 25     versionCode 1     versionName "1.0"     ...   } } 
like image 54
yannickpulver Avatar answered Sep 17 '22 18:09

yannickpulver


We can not install apps that target L Preview on anything but L devices.

Changing res/values/styles.xml, Theme.Material.Light to Theme.Light and following build.gradle worked for me.

android {     compileSdkVersion 20     buildToolsVersion '20.0.0'     defaultConfig {         applicationId 'com.example.android.market.licensing'         minSdkVersion 13         targetSdkVersion 20         versionCode 1         versionName '1.0'     } 

Although Theme.Material.Light is part of the 20sdk version but somehow it is not working for me.

like image 21
Nicks Avatar answered Sep 18 '22 18:09

Nicks