如何解决 android manifest.xml 命名冲突?
How to fix android manifest.xml naming conflict?
出于某种原因,即使我的应用程序名称正确显示在应用程序图标旁边,但当我在设置-> 应用程序下查找该应用程序时,该名称似乎是 "libcocos2dx" 而不是正确的名称。
所以我在 AndroidManifest.xml 中添加了以下行:
android:label="@string/app_name"
但它导致了错误:
app/AndroidManifest.xml:12:6 Error:
Attribute application@label value=(@string/app_name) from AndroidManifest.xml:12:6
is also present at proj.android-studio:libcocos2dx:unspecified:13:9 value=(libcocos2dx)
Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:11:5 to override
如何解决上述错误?我不知道 libcocos2dx 在哪里被指定为名称。我正在使用 cocos2d-x v3.7,它使用 libcocos2dx.
编辑:我可以看到使用 "tools:replace" 的建议,但我觉得我是在掩盖问题而不是解决问题。有没有更好的方法来解决根本原因?
编辑:有人知道如何添加 tools:replace 吗?这对您来说似乎很明显,但是当我添加它时,出现错误:
the prefix "tools" for attribute "tools:replace" associated with an
element type "application" is not bound
必须添加到清单 header:
xmlns:tools="http://schemas.android.com/tools"
例如:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yourpackage"
xmlns:tools="http://schemas.android.com/tools">
然后在元素中:
'tools:replace="android:label"'
当我想在我的 NativeScript 项目中设置 android:allowBackup
时,此线程中的 对我帮助很大。
我最终得到了这样的完整文件:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<application tools:replace="android:allowBackup" android:allowBackup="true">
</application>
</manifest>
出于某种原因,即使我的应用程序名称正确显示在应用程序图标旁边,但当我在设置-> 应用程序下查找该应用程序时,该名称似乎是 "libcocos2dx" 而不是正确的名称。
所以我在 AndroidManifest.xml 中添加了以下行:
android:label="@string/app_name"
但它导致了错误:
app/AndroidManifest.xml:12:6 Error:
Attribute application@label value=(@string/app_name) from AndroidManifest.xml:12:6
is also present at proj.android-studio:libcocos2dx:unspecified:13:9 value=(libcocos2dx)
Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:11:5 to override
如何解决上述错误?我不知道 libcocos2dx 在哪里被指定为名称。我正在使用 cocos2d-x v3.7,它使用 libcocos2dx.
编辑:我可以看到使用 "tools:replace" 的建议,但我觉得我是在掩盖问题而不是解决问题。有没有更好的方法来解决根本原因?
编辑:有人知道如何添加 tools:replace 吗?这对您来说似乎很明显,但是当我添加它时,出现错误:
the prefix "tools" for attribute "tools:replace" associated with an element type "application" is not bound
必须添加到清单 header:
xmlns:tools="http://schemas.android.com/tools"
例如:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yourpackage"
xmlns:tools="http://schemas.android.com/tools">
然后在元素中:
'tools:replace="android:label"'
android:allowBackup
时,此线程中的 我最终得到了这样的完整文件:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<application tools:replace="android:allowBackup" android:allowBackup="true">
</application>
</manifest>