前言
最近想搞个flutter 项目,本人初学,在启动flutter时,报了以下错误
D:\developSoftware\flutter\workspace\chat_flutter\android\app\src\debug\AndroidManifest.xml:4:9-37 Error:
Attribute application@label value=(chat_flutter) from AndroidManifest.xml:4:9-37
is also present at [com.tencent.imsdk:imsdk:4.9.6] AndroidManifest.xml:18:9-41 value=(@string/app_name).
Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:3:4-40:19 to override.
结局方案
错误中描述的很清楚,在application标签中添加 'tools:replace="android:label"'
可我看了我的文件中没有application标签
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.chat_flutter">
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
于是还是去网上搜了一下,网上说直接新加applcaition标签,改造如下
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.chat_flutter">
<application tools:replace="android:label" >
</application>
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
但这时有报了个错误
错误时说 android:label 属性无value值
D:\developSoftware\flutter\workspace\chat_flutter\android\app\src\debug\AndroidManifest.xml:4:5-6:19 Error:
tools:replace specified at line:4 for attribute android:label, but no new value specified
D:\developSoftware\flutter\workspace\chat_flutter\android\app\src\debug\AndroidManifest.xml Error:
Validation failed, exiting
于是最终改造如下:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.chat_flutter">
<application tools:replace="android:label" android:label="XXXX">
</application>
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>