merge – How to disable manifest merging in Android Studio-ThrowExceptions

Exception or error:

I am having a hard time removing unnecessary (permissions) stuff from my manifest file after compiling and sigining a release version of my app.
I simply don’t want anything merged from other libraries’s manifest files. I have my own manifest file and thats it. no other manifest should be merged in

anyone knows how to completely disable manifest merging?

How to solve:

Try this

 android.applicationVariants.all{ variant ->
   variant.outputs.each { output ->
     output.processResources.manifestFile = file('AndroidManifest.xml')
     output.processManifest.enabled=false
   }
 }

###

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
}

This should work.

Leave a Reply

Your email address will not be published. Required fields are marked *