21

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?

rene
  • 41,474
  • 78
  • 114
  • 152
Gillis Haasnoot
  • 2,229
  • 1
  • 19
  • 23

2 Answers2

3

Try this

 android.applicationVariants.all{ variant ->
   variant.outputs.each { output ->
     output.processResources.manifestFile = file('AndroidManifest.xml')
     output.processManifest.enabled=false
   }
 }
  • 1
    This doesn't really work for different kinds of product flavors and build configurations once you clean the project. You will start getting errors messages when building, complaining that the manifest file could not be found. – Anyonymous2324 Nov 05 '15 at 14:39
2

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.

shreyas
  • 2,166
  • 3
  • 18
  • 30