Search code examples
androidgradleandroid-gradle-pluginandroid-libraryjitpack

Can't add library from jitpack in Gradle


I am trying to use the following library:

https://github.com/lguipeng/AnimCheckBox

I have added maven { url "https://jitpack.io" } like so:

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.google.com/'
        }
        maven { url "https://jitpack.io" }
    }
}

But when I try to build my project I get the following error:

Manifest merger failed : Attribute application@allowBackup value=(false) from AndroidManifest.xml:10:9-36 is also present at [com.github.lguipeng:AnimCheckBox:1.0.1] AndroidManifest.xml:12:9-35 value=(true). Suggestion: add 'tools:replace="android:allowBackup"' to element at AndroidManifest.xml:9:5-46:19 to override.

I'd rather not allow my app to be backed up, is there an alternative way to resolve this error then the one suggested in the above message?


Solution

  • Your issue is that the library has defined "allowBackup=true", while your own app defines it as "allowBackup=false".

    To tell Gradle that it should use YOUR definition and not the one from the library, then you need to add the following attribute to the application tag of your manifest:

    tools:replace="android:allowBackup"