Skip to content
TheChatArchiveThe Chat Archive
gpt-4-0125-preview· openaiHugging Face Suzhen/CodeChat

Manifest merger failed : Attribute application@allowBackup value=(false) from…

  1. 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.

  2. 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 allowBackup attribute of the <application> element. Your app's manifest specifies android:allowBackup="false", whereas the Viger-PDF library you've added sets android: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 the allowBackup value 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:

    1. Add the xmlns:tools namespace 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">
          ...
      
    2. Add the tools:replace="android:allowBackup" attribute to the <application> element:

      <application
          ...
          android:allowBackup="false"
          tools:replace="android:allowBackup">
          ...
      </application>
      
    3. 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 allowBackup attribute, allowing your project to build successfully.