android - Gradle : Error retrieving parent for item: No resource found that matches the given name '@style/SomeTheme' -
i've library project has java source , resources.
in application i'm referring resources library project. working fine, add product flavours in library project following error.
error:(1) error retrieving parent item: no resource found matches given name '@style/sometheme'.
please see flavours added.
productflavors { production { } staging { } }
if remove these flavours, things working fine.
what other things should make sure resources available application project when new flavours added library project ?
i not want add defaultpublishconfig "dev1production" entry library project.
what else can fix problem ?
build.gradle of library project
apply plugin: 'com.android.library'
android { compilesdkversion 22 buildtoolsversion "22.0.1" defaultconfig { minsdkversion 14 targetsdkversion 22 versioncode 1 versionname "1.0" } // defaultpublishconfig "dev1debug" // publishnondefault true productflavors { production { } staging { } } 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:22.2.0' }
style.xml library project
<resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="someapptheme" parent="@style/sometheme"> <!-- customize theme here. --> <item name="android:windowdisablepreview">true</item> </style> <!-- base application theme, dependent on api level. theme replaced appbasetheme res/values-vxx/styles.xml on newer devices. --> <style name="somethemebasejw" parent="@style/theme.appcompat.light"> <!-- theme customizations available in newer api levels can go in res/values-vxx/styles.xml, while customizations related backward-compatibility can go here. --> </style> <!-- application theme. --> <style name="sometheme" parent="@style/somethemebasejw" /> <style name="theme.translucent.notitlebar" parent="@android:style/theme.translucent.notitlebar"> <!-- customize theme here. --> <item name="android:windownotitle">true</item> </style> </resources>
androidmanifest library project
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.mhood.testlibrary" > <application android:allowbackup="true" android:label="@string/app_name" > <activity android:name=".mainactivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> </application> </manifest>
try configuration:
it best have structure listing "parent" theme first. list of application themes(the ones inherit parent).
<resources xmlns:android="http://schemas.android.com/apk/res/android"> <!-- list base theme first --> <style name="somethemebase" parent="@style/theme.appcompat.light"> <!-- customize theme here --> </style> <!-- app theme inherits parent base theme --> <style name="someapptheme" parent="@style/somethemebase"> <!-- customize theme here --> <item name="android:windowdisablepreview">true</item> </style> <!-- app theme inherits parent base theme --> <style name="sometheme" parent="@style/somethemebase" /> <!-- app theme inherits parent base theme --> <style name="theme.translucent.notitlebar" parent="@android:style/theme.translucent.notitlebar"> <!-- customize theme here --> <item name="android:windownotitle">true</item> </style> </resources>
Comments
Post a Comment