Suggestion: add 'tools:replace="android:name"' to element at AndroidManifest.xml
16lz
2021-01-23
环境
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】application标签说明
- android中application标签说明
- Android studio 启动出现错误AAPT: error: resource android:att
- 相对布局RelativeLayout的妙用:提示标签在输入框内
- android流式布局热门标签的实现