5

I'm facing below using while compiling the project

Below are the error logs

Error:Execution failed for task ':sampleproject:processDebugAndroidTestManifest'.
> java.lang.IllegalArgumentException: Multiple entries with same key: android:allowBackup=REPLACE and android1:allowBackup=REPLACE

AndroidManifest.XML

<?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.sample.mini" >

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />

    <uses-sdk tools:overrideLibrary="com.sample.toolkit.payment"/>

    <application
        android:allowBackup="false"
        android:icon="@mipmap/icn_app"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:supportsRtl="false"
        android:theme="@style/MaterialTheme"
        tools:replace="android:label, theme, allowBackup, android:icon,android:supportsRtl">


        <activity
            android:name="com.sample.SwiftActivity"
            android:screenOrientation="portrait"
            android:theme="@style/MaterialTheme" />

        <activity
            android:name="com.activities.TermsAndConditionActivity"
            android:screenOrientation="portrait"
            android:theme="@style/MaterialTheme" />


    </application>


</manifest>
Lavekush Agrawal
  • 6,040
  • 7
  • 52
  • 85

7 Answers7

13

Try removing the spaces from your tools:replace list.

tools:replace="android:label,theme,allowBackup,android:icon,android:supportsRtl"

This fixed the build error for me, but I'm still trying to figure out why entries after the space are ignored

loadedion
  • 2,217
  • 19
  • 41
0

Try to add android: to the front of allowBackup in the tools:replace list

tools:replace="android:label,theme,android:allowBackup,android:icon,android:supportsRtl"
jpeg
  • 2,372
  • 4
  • 18
  • 31
0

I got same failure notice:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Multiple entries with same key: android:supportsRtl=REPLACE and android:supportsRtl=REPLACE

android AndroidManifest.XML is:

<application
    android:name=".MyApplication"
    android:allowBackup="false"
    android:supportsRtl="false"
    tools:replace="android:allowBackup,android:supportsRtl"
    android:icon="@drawable/icon"
    android:networkSecurityConfig="@xml/network_security_config"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:manageSpaceActivity=".ManageSpaceActivity">

finally I fixed it by add a space between "android:allowBackup," and "android:supportsRtl"

tools:replace="android:allowBackup, android:supportsRtl"

I don't know why, but I think it may be Android Studio's bug, hope it will give you suggestions to fix your problem.

0

In My Case it was Happening Because i added PayuMoney Payment Gateway's PlugnPlay Dependency. After Removing it, i was able to build my App.

Rakesh Patil
  • 91
  • 2
  • 10
0

try to remove android: in each item

tools:replace="android:label, theme, allowBackup, android:icon,android:supportsRtl">
0

I also got the same error.

tools:replace="label,android:allowBackup,android:theme"

So I added android: in front of the label

-2

Try my plugin to fix it.

Seal - A gradle plugin to do precheck of Android Manifest.

1.Compile&apply Seal plugin:

// project's build.gradle
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.1'
        classpath 'me.xx2bab.gradle:seal-manifest-precheck-plugin:1.0.0'
    }
}

...

// app's build.gradle
apply plugin: 'seal'

2.Configurations:

def projectRoot = project.getRootProject().rootDir.absolutePath

// Folders may include AndroidManifest.xml files
// 1. For gradle plugin 2.3.0 or higher, build-cache is default choice,
// 2. But we should make sure snapshot-libs will be checked too.
// 3. Free to add your folders for more customization 
def manifestPath = [
        // for AAR of Release
        // see note below
        projectRoot + '/build-cache', 
        // for AAR of SNAPSHOT
        projectRoot + '/app/build/intermediates/exploded-aar'
]

def removeAttrs = [
        'android:debuggable'
]

def replaceValues = [
        'android:allowBackup'
]


seal {
    enabled = true
    manifests = manifestPath

    appAttrs {
        enabled = true
        attrsShouldRemove = removeAttrs
    }

    appReplaceValues {
        enabled = true
        valuesShouldRemove = replaceValues
    }
}

3.Note: If build-cache is enable, Seal recommends that custom build cache folder placed in the Project Folder.

//gradle.properties
android.buildCacheDir=./build-cache
...
2BAB
  • 1,215
  • 10
  • 18
  • 2
    From my experience is better to find the change that suddenly broke a stable project and try to understand what the problem is. Adding this kind of iron bullets increase build times and can also hide real issues that fired the error. – Nahuel Barrios Feb 05 '19 at 20:35