I am using the new gradle android buildsystem.
The project consists of two android library projects and one main project.
Using the ant build, the manifest merger must be enable in project.properties. But when using the gradle build system the manifest merger is enabled by default. How can i disable the manifest merger?
Even before you build your app, you can see a preview of what your merged manifest looks by opening your AndroidManifest. xml file in Android Studio, and then clicking the Merged Manifest tab at the bottom of the editor.
Some Useful Tricks to Solve Merge ErrorsAdd the overrideLibrary attribute to the <uses-sdk> tag. This may be useful when we try to import a library with a minSdkVersion value that is higher than the manifest file and an error occurs. The overrideLibrary tag lets the merger tool ignore this conflict.
Open your Android project and go to <AppProjectFolder>/app/src/main/. Open the app manifest file AndroidManifest. xml and add the following lines to the file as child elements of the <manifest> element. Note: You must include the QUERY_ALL_PACKAGES permission if your app targets Android 11 (API Level 30) or higher.
Every Android app project must include an AndroidManifest. xml file in the root of the project source set. The manifest file informs the Android build tools, the Android operating system, and Google Play with important information about your app.
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.
This may help.
android.applicationVariants.all{ variant ->
variant.outputs.each { output ->
output.processResources.manifestFile = file('AndroidManifest.xml')
output.processManifest.enabled=false
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With