问题
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!
回答1:
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.
来源:https://stackoverflow.com/questions/46934387/attribute-applicationallowbackup-value-false-from-androidmanifest-xml-is-also