Manifest merger failed : Attribute application@allowBackup value=(false) from…
- User
Manifest merger failed : Attribute application@allowBackup value=(false) from AndroidManifest.xml:20:3-30 is also present at [com.github.aerdy:Viger-PDF:1.2] AndroidManifest.xml:14:9-35 value=(true). Suggestion: add 'tools:replace="android:allowBackup"' to element at AndroidManifest.xml:18:2-147:16 to override.
- Assistant
The error you're encountering during the manifest merger process is a common issue when integrating third-party libraries into your Android project. Libraries or modules included in your project can contain AndroidManifest.xml files with settings that conflict with the ones defined in your app's primary AndroidManifest.xml file.
The specific error you're facing is due to a conflict in the
allowBackupattribute of the<application>element. Your app's manifest specifiesandroid:allowBackup="false", whereas theViger-PDFlibrary you've added setsandroid:allowBackup="true". As both these settings cannot be true simultaneously, the build process fails, requiring a resolution.The error message you've received also contains the suggested fix. You can resolve this conflict by adding the
tools:replace="android:allowBackup"attribute to the<application>element in your app's AndroidManifest.xml. This tells the Android build tools to replace theallowBackupvalue in the merged manifest with the value specified in your app's manifest, effectively resolving the conflict.Here's how you can apply the suggested fix:
-
Add the
xmlns:toolsnamespace to the root<manifest>element of your app's AndroidManifest.xml file if it's not already there:<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="your.package.name" xmlns:tools="http://schemas.android.com/tools"> ... -
Add the
tools:replace="android:allowBackup"attribute to the<application>element:<application ... android:allowBackup="false" tools:replace="android:allowBackup"> ... </application> -
Make sure you have the Android SDK build-tools installed in your project. If not, you can add them through your build.gradle file by including the necessary tools version. For example:
buildscript { repositories { google() mavenCentral() } dependencies { classpath "com.android.tools.build:gradle:[VERSION]" } }
Replace
[VERSION]with the appropriate version of the Android build-tools.By applying this fix, your app's manifest takes precedence over the library's manifest for the
allowBackupattribute, allowing your project to build successfully. -