My project has multiple build variants and each build variant has 15-20 buildConfigFields which can increase further. Because of which my build.gradle (app level) file is getting bigger so I need to traverse/search whole file to look for a specific build variant.
I'm looking for a solution where I can have different files for each build variant and I can easily import them into my build.gradle (app level).
You can also share if any other recommended solutions for this if available.
The whole project would be like this:
apply plugin: 'com.android.library'
android {
....
publishNonDefault true
productFlavors {
market1 {}
market2 {}
}
}
apply plugin: 'com.android.application'
android {
....
productFlavors {
market1 {}
market2 {}
}
}
dependencies {
....
market1Compile project(path: ':lib', configuration: 'market1Release')
market2Compile project(path: ':lib', configuration: 'market2Release')
}
Now you can select the app flavor and Build Variants panel and the library will be selected accordingly and all build and run will be done based on the selected flavor.
If you have multiple app modules based on the library Android Studio will complain about Variant selection conflict, It's ok, just ignore it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.