Reputation: 6136
I want to use different manifests for the debug and release builds of my 3 flavours, how can I do this?
android {
productFlavors {
flavor1 {}
flavor2 {}
flavor3 {}
}
}
Upvotes: 3
Views: 4566
Reputation: 6136
okay so I found two ways,
1) create release/debug folder under appname/src folder and keep the different manifests there.
as pointed by Vishva Dave is here https://stackoverflow.com/a/29317682/8089770
2) set the release/debug manifest in buildtypes of build.gradle, similar to the suggestion by Jeelan but for build types and not flavors
buildTypes {
debug {
jniDebuggable true
debuggable true
**manifest.srcFile['src/debug/AndroidManifest.xml']**
}
Upvotes: 1
Reputation: 173
To use another manifest file for particular build the procedure is as follows:
In App build.gradle[ie.Module App] under sourceSets add like this:
sourceSets {
// Default
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
java.srcDirs = ['src/main/java']
resources.srcDirs = ['src/main/java']
aidl.srcDirs = ['src/main/java']
renderscript.srcDirs = ['src/main/java']
res.srcDirs = ['src/main/res']
assets.srcDirs = ['src/main/assets']
}
// Custom
flavor3 {
manifest.srcFile['src/another_manifest_path/AndroidManifest.xml']
...
..other
}
}
Please let me know if it works.
Upvotes: 3