1
我有一个包含字符串资源库:Android的多味库 - AAPT:没有资源发现
<string name="lib_name">MyLibrary</string>
参考图书馆应用的build.gradle:
dependencies{
compile project(':mylibrary')
...
}
在应用程序模块我已经显示此文本消息:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/lib_name" />
没有问题w没有使用口味。 现在我想添加新的味道,以不同的文字库。
的build.gradle库:
android {
...
productFlavors {
myFlavor {}
}
}
然后,我创建了新口味新的资源文件\在MyLibrary的\ src \ myFlavor \水库\值\ strings.xml中:
<string name="lib_name">MyLibrary My Flavor</string>
但现在我有建立错误,资源不再可用:
AAPT: No resource found that matches the given name (at 'text' with value '@string/lib_name').
我需要这个应用程序只有默认的味道。 'myFlavor'中的资源将在不同的应用程序中使用,它也会指定'myFlavor'风格。
我需要在应用程序中更改以解决此错误?
谢谢你的帮助。
编辑: 我上传了我的示例项目here。
什么build.gradle文件你有风味定义? –
在库模块的build.gradle(它写在我的问题上面)。应用程序模块没有定义风味。 –