Attribute application@allowBackup value=(false) from AndroidManifest.xml is also present at [:barcodescanner:] AndroidManifest.xml value=(true)

Sumit Manna picture Sumit Manna · Oct 25, 2017 · Viewed 12.5k times · Source

I’m trying to set the allowBackup attribute in my ionic 3 app manifest to false but gradle complains with the following error:

Attribute application@allowBackup value=(false) from AndroidManifest.xml:4:18-45 is also present at [:barcodescanner:] AndroidManifest.xml:12:9-35 value=(true). Suggestion: add 'tools:replace="android:allowBackup"' to element at AndroidManifest.xml:4:5-11:19 to override.

To Set allowBackup=false using below line in config.xml file

<platform name="android"> <edit-config file="AndroidManifest.xml" target="/manifest/application" mode="merge"> <application android:allowBackup="false"/> </edit-config> </platform>

I use Barcode Scanner in my ionic 3 app.(Repo: https://github.com/phonegap/phonegap-plugin-barcodescanner recommended in https://ionicframework.com/docs/native/barcode-scanner/)

please help me. Thanks!

Answer

Pranav Mahajan picture Pranav Mahajan · Jan 12, 2018

You have to tell the compiler to ignore the attribute from the external library. The way to do that is to add this line in application tag:

tools:replace="android:allowBackup"

PS: To access the tools add xmlns:tools="http://schemas.android.com/tools" in the manifest tag at the top.