Manifest.xmlError in label application name in

I encountered this error writing code today

Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@label value=(@string/app_name) from AndroidManifest.xml:18:9-42
    is also present at [org.litepal.android:core:1.6.0] AndroidManifest.xml:13:9-41 value=(@string/app_name).
    Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:14:5-67:19 to override.

This error is because some of the third-party libraries you imported define the same properties as the main project.
The hint above is that the library litepal conflicts with the label property in the main project AndroidManifest file.The hint also gives the solution by adding under the application node of AndroidManifestTools:replace="Android:label"

    <application
        android:name=".base.MyApplication"
        android:allowBackup="true"
        android:icon="@mipmap/logo_128"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:supportsRtl="true"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar"
        tools:replace="android:icon, android:label, android:theme">
        ...
    </application>

If you add it, you can compile, but the name of the APP still uses app_from a third-party libraryName, we can do this in our ownStrings.xmlMiddleman app_Change the name, for example, to app_name_

<string name="app_name_">move APP</string>

Then the manifest file looks like this

    <application
        android:name=".base.MyApplication"
        android:allowBackup="true"
        android:icon="@mipmap/logo_128"
        android:label="@string/app_name_"
        android:screenOrientation="portrait"
        android:supportsRtl="true"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar"
        tools:replace="android:icon, android:label, android:theme">
        ...
    </application>

That way you can run it again and use your own name.

Tags: Android xml Attribute

Posted on Thu, 16 Jul 2020 12:24:19 -0400 by Niko