gradle - Android multi flavor library referenced from non flavor application - AAPT: No resource found -
i have library contains string resource:
<string name="lib_name">mylibrary</string>
reference library in application build.gradle:
dependencies{ compile project(':mylibrary') ... }
in application module have displayed text resource:
<textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/lib_name" />
there no problem without using flavors. want add new flavor library different text.
build.gradle of library:
android { ... productflavors { myflavor {} } }
then create new resource file new flavor \mylibrary\src\myflavor\res\values\strings.xml:
<string name="lib_name">mylibrary flavor</string>
but have build error, resource not available anymore:
aapt: no resource found matches given name (at 'text' value '@string/lib_name').
i need application has default flavor. resource in 'myflavor' consumed in different application, have 'myflavor' flavor specified.
what need change in application solve error?
thank help.
edit: uploaded sample project here.
firstly, change flavor configuration dependency:
compile project(path: ':mylibrary', configuration: 'myflavorrelease')
secondly, replace wrong androidmanifest.xml in *mylibrary\src\myflavor* correct in *mylibrary\src\main*.
Comments
Post a Comment