Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix android manifest.xml naming conflict?

For some reason, even though my app name appeared correctly next to the app icon, when I looked for the app under settings->app, the name appeared to be "libcocos2dx" instead of the correct name.

So I added the following line in my AndroidManifest.xml:

    android:label="@string/app_name"

But it caused the error:

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

How can I fix the above error ? I have no idea where libcocos2dx is specified as the name. I am using cocos2d-x v3.7, which uses libcocos2dx.

EDIT: I can see the suggestion to use "tools:replace" , but I feel like I'm masking the problem instead of fixing it. Is there a better way to fix the root cause ?

EDIT: Does anyone know how to add tools:replace ? This might seem obvious to you, but when I add it, I get the error:

the prefix "tools" for attribute "tools:replace" associated with an element type "application" is not bound

like image 334
Rahul Iyer Avatar asked Aug 14 '15 04:08

Rahul Iyer


People also ask

What is Android manifest XML file and why do you need this?

Every app project must have an AndroidManifest. xml file (with precisely that name) at the root of the project source set. The manifest file describes essential information about your app to the Android build tools, the Android operating system, and Google Play.

Where is the Android manifest XML file?

Every project in Android includes a Manifest XML file, which is AndroidManifest. xml, located in the root directory of its project hierarchy. The manifest file is an important part of our app because it defines the structure and metadata of our application, its components, and its requirements.


1 Answers

Had to add to the manifest header:

xmlns:tools="http://schemas.android.com/tools"

For example:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.yourpackage"
    xmlns:tools="http://schemas.android.com/tools">

Then in the element:

'tools:replace="android:label"'
like image 174
Rahul Iyer Avatar answered Sep 28 '22 23:09

Rahul Iyer