27

Update:

I have tried everything. Is there something wrong with Manifest merger tool?

  • tools:replace
  • tools:remove
  • tools:ignore
  • tools:node

Unable to resolve the following error:

D:\AndroidStudioProjects\Iknowthis2\app\src\main\AndroidManifest.xml:29:9-36
Error: Attribute application@allowBackup value=(false) from AndroidManifest.xml:29:9-36 is also present at [com.sackcentury:shinebutton:0.1.5] AndroidManifest.xml:12:9-35 value=(true).     
Suggestion: add 'tools:replace="android:allowBackup"'to <application> element at AndroidManifest.xml:27:5-73:19 to override.

D:\AndroidStudioProjects\Iknowthis2\app\src\main\AndroidManifest.xml:34:9-36
Error:  Attribute application@supportsRtl value=(false) from AndroidManifest.xml:34:9-36 is also present at [com.sackcentury:shinebutton:0.1.5] AndroidManifest.xml:14:9-35 value=(true).
Suggestion: add 'tools:replace="android:supportsRtl"' to <application> element at AndroidManifest.xml:27:5-73:19 to override.

App's Original Manifest.xml - Before tools:replace

 <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="xyz">

    <!-- Include following permission if you load images from Internet -->
    <uses-permission android:name="android.permission.INTERNET" />
    <!-- Include following permission if you want to cache images on SD card -->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application
        android:name=".ABC"
        android:allowBackup="false"
        android:fullBackupContent="false"
        android:hardwareAccelerated="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="false"
        android:theme="@style/Theme"
        tools:ignore="GoogleAppIndexingWarning,UnusedAttribute">


        <activity
            android:name="com.facebook.FacebookActivity"
            android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" />

        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/facebook_app_id" />

        <activity
            android:name=".activity.SignInActivity"
            android:windowSoftInputMode="adjustPan">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

Library's Manifest.xml:

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

    <application android:allowBackup="true" android:label="@string/app_name"
        android:supportsRtl="true">

    </application>

</manifest>
Hisham Muneer
  • 8,558
  • 10
  • 54
  • 79

5 Answers5

66

In my case,

removing tools:ignore from the Manifest files and adding tools:replace="allowBackup,supportsRtl" worked for me.

Update:

One more solution looks promising, however I never tried it.

 <application
    xmlns:tools="http://schemas.android.com/tools"  <-- added tools on application tag
    android:name=".ABC"
    android:allowBackup="false"
    android:fullBackupContent="false"
    android:hardwareAccelerated="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="false"
    android:theme="@style/Theme"
    tools:replace="allowBackup,supportsRtl"
    tools:ignore="GoogleAppIndexingWarning,UnusedAttribute">
Hisham Muneer
  • 8,558
  • 10
  • 54
  • 79
  • Actually the magic will happen if you remove tools:ignore, because tools:replace has been included. Both can not work together well!! – Stoycho Andreev Jul 14 '17 at 15:00
  • removing tools:ignore worked for me , thanks it was driving me crazy :) – A.Alqadomi Oct 31 '17 at 10:45
  • When i add my custom dependency module library, my App run and Every time crashed with throw IllegalStateException java.lang.IllegalStateException: A required meta-data tag in your app's AndroidManifest.xml does not exist. You must have the following declaration within the element: – Divyesh Patel Dec 19 '17 at 07:13
  • This will not work if you keep the android:fullBackupContent="false". It's not a boolean attribute. see https://developer.android.com/guide/topics/data/autobackup#IncludingFiles – bashizip May 15 '19 at 02:22
9

As I know, we can't use both tools:replace and tools:ignore. So you might remove one from your AndroidManifest.xml declaration.

Filipe Bezerra de Sousa
  • 2,874
  • 1
  • 17
  • 17
2

It working fine for me.My manifest files look like:

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

 <application       
    android:allowBackup="false"
    android:fullBackupContent="false"
    android:hardwareAccelerated="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"       
    android:supportsRtl="false"
    android:theme="@style/AppTheme"
    android:usesCleartextTraffic="true"
    tools:replace="allowBackup,supportsRtl"
    tools:ignore="GoogleAppIndexingWarning,UnusedAttribute">

    </application>

  </manifest>
Enamul Haque
  • 4,789
  • 1
  • 37
  • 50
1

Add following code in Manifest file -

Just add tools:replace="android:allowBackup" in application Tag

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.example.exampleapp">

<application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        tools:replace="android:allowBackup">
</application>
  • Not a solution because default value is set to `true`, meaning, your app can be backed-up! Read here > https://developer.android.com/guide/topics/data/autobackup#EnablingAutoBackup Hence, if you want to disable that feature, you have to handle this. – sud007 Oct 07 '19 at 09:47
-3

Just add tools:replace = "android:allowBackup" in your application tag in the Manifest. This will work.

  • This is a duplicate answer. Please make sure your answer is offering a new solution which does not already exist on the question. – Arpit May 15 '20 at 07:34