40

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!

tynn
  • 38,113
  • 8
  • 108
  • 143
Sumit Manna
  • 541
  • 1
  • 5
  • 16

1 Answers1

104

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.

Pranav Mahajan
  • 2,048
  • 2
  • 23
  • 36
  • 1
    Tested and works here - thanks much for this - No clue how I could have solved it otherwise. – gregpress Oct 31 '19 at 01:30
  • 2
    i have got same error while adding flutter_zoom_sdk packages , and after adding ---> tools:replace="android:allowBackup" i got another error which is in below ---- > tools:replace specified at line:14 for attribute android:allowBack, but no new value specified – santosh thapa Jan 23 '22 at 08:53