Disable Manifest Merger in Android Gradle Build

Edit: this is actually possible though indirectly, starting with 0.3

What you need to do is disable the processManifest task so that it doesn’t run and tell the processResources where the manifest to use is:

android.applicationVariants.all { variant ->
    variant.processResources.manifestFile = file('src/main/AndroidManifest.xml')
    variant.processManifest.enabled=false
}

Note that if you are customizing the app package name through the DSL, you should keep the default manifest untouched in the default location to provide a consistent package name for the R classes, and then have your manually merged manifests somewhere else and point each variant processResources task to them.

Leave a Comment