在我的 android 项目中安装新库后,出现以下错误:
/android/app/src/debug/AndroidManifest.xml Error:
Attribute application@label value=(Compassion) from (unknown)
is also present at [com.github.master] AndroidManifest.xml:15:9-41 value=(@string/app_name).
Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:6:4-36:19 to override.
FAILURE: Build failed with an exception.
经过一番研究,我发现新安装的库也有一个
application@label
属性,所以你所要做的就是修改你的 AndroidManifest.xml
文件,添加以下两行代码:
xmlns:tools="http://schemas.android.com/tools"
添加到清单标签<manifest
xmlns:tools="http://schemas.android.com/tools">
...
tools:replace="android:label"
添加到应用程序标签...
<application
tools:replace="android:label">
转到主 AndroidManifest.xml 并粘贴下面这两行
在清单标签中
xmlns:tools="http://schemas.android.com/tools"
并在应用程序标签中
tools:replace="android:label"
这对我有用
您可以在 Manifest 应用程序标签中添加此行
tools:replace="android:name"
如果您使用的是 androidx,请在 gradle 属性中使用此行
android.enableJetifier=true