Suggestion: add 'tools:replace="android:name"' to element at AndroidManifest.xml
阿新 • • 發佈:2018-12-28
環境
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>