AS解决在导入library之后lable/icon/theme合并出现bug

#在导入某些library之后在application添加lable会报错

Error:(52, 9) Attribute application@label value=(@string/app_name_wear) from AndroidManifest.xml:52:9
	is also present at CavyTech:percent-support-extends:1.1.1:13:9 value=(@string/app_name)
	Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:48:5 to override
:wear2:processDebugManifest FAILED

本人是在导入opencamera之后 直接报错,此时如果去掉application中的lable 此时APP名称就是opencamera。
#解决方法

<application
        tools:replace="android:label"
	           xmlns:tools="http://schemas.android.com/tools"

之后再添加 android:label="@string/app_name" 就OK了

同样可以解决icon theme等问题
#原理
AS的Gradle插件默认会启用Manifest Merger Tool,若Library项目中也定义了与主项目相同的属性(例如默认生成的android:icon和android:theme),则此时会合并失败,并报上面的错误。

扫码关注公众号“伟大程序猿的诞生“,更多干货新鲜文章等着你~

公众号回复“资料获取”,获取更多干货哦~

有问题添加本人微信号“fenghuokeji996” 或扫描博客导航栏本人二维码

发布了97 篇原创文章 · 获赞 961 · 访问量 49万+

猜你喜欢

转载自blog.csdn.net/github_33304260/article/details/51721112