Is It Possible To Have Different Build.gradles For Different Product Flavors?
The project that I am working is built for both Amazon based devices as well as Android. Almost of 95% of the code base is common between these two. So instead of making these two
Solution 1:
It should be a comment, but it is too long. I will delete it if it will not provide an help.
As I know you can't have different build.gradle
for product flavors.
However you should be able to condition the buildscript
and the compileSdkVersion
.
It is not so clean but you can use something like:
buildscript {
repositories {
jcenter()
mavenCentral()
}
if (condition) {
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0+'
}
} elseif (condition) {
dependencies {
classpath 'com.amazon.device.tools.build:gradle:1.1.3'
}
}
}
android {
if (condition) {
compileSdkVersion 23
} elseif (condition) {
compileSdkVersion "Amazon.com:Amazon Fire Phone SDK Addon:XX"
}
//...
}
Post a Comment for "Is It Possible To Have Different Build.gradles For Different Product Flavors?"