Suggestion: add 'tools:replace="android:name"' to element at AndroidManifest.xml
16lz
2021-12-04
环境
AS 3.1.4
情形
类中创建了一个继承自Application
的类,并在AndroidManifest.xml注册。编译报错,提示"Suggestion: add ‘tools:replace=“android:name”’ to element at AndroidManifest.xml"
查找原因
通过网络搜索,找到android:icon
,android:theme
等相似问题的解决方法,确定问题原因是module中同样有一个继承自Application
的类。
解决方法
在AndroidManifest.xml的根标签下加上 xmlns:tools="http://schemas.android.com/tools"
,然后在application
标签下加入tools:replace="android:name"
。如下所示
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.**"> <application android:name="com.**.App" android:allowBackup="true" android:icon="@mipmap/app_icon" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme" tools:replace="android:name"> application>manifest>
更多相关文章
- android中include标签的使用
- 使用Android(安卓)Studio解决Android(安卓)65k问题
- Android中attr自定义属性详解
- 【Android】选项卡使用
- android 测试
- 【Android】application标签说明
- Android(安卓)studio 启动出现错误AAPT: error: resource androi
- android中application标签说明
- Android(安卓)layout布局属性、标签属性总结大全