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

混江龙づ霸主 提交于 2020-02-27 04:34:12

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!