I have a gradle build that has 32 flavors and builds for 5 hours?
Here is my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 17
buildToolsVersion "21.1.2"
dexOptions {
preDexLibraries false
}
defaultConfig {
minSdkVersion 14
targetSdkVersion 17
multiDexEnabled true
versionCode 3
versionName '3.0.0.0'
}
signingConfigs {
signingConfig1 {
storeFile file('keystores/signingConfig1.keystore')
storePassword 'signingConfig1'
keyAlias 'signingConfig1'
keyPassword 'signingConfig1'
}
...
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
productFlavors {
flavor1 {
applicationId "com.mycompany.project.flavor1"
signingConfig signingConfigs.signingConfig1
}
flavor2 {
applicationId "com.mycompany.project.flavor2"
signingConfig signingConfigs.signingConfig2
}
...
flavor32 {
applicationId "com.mycompany.project.flavor32"
signingConfig signingConfigs.signingConfig32
}
}
sourceSets {
flavor1.res.srcDir 'src-flavors/flavor1/res'
flavor2.res.srcDir 'src-flavors/flavor2/res'
...
flavor32.res.srcDir 'src-flavors/flavor32/res'
}
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:support-v4:18.0.0'
compile 'com.android.support:appcompat-v7:20.0.0'
compile files('libs/stock-chart-full.jar')
compile files('libs/bcprov-jdk15on-1.47.jar')
compile files('libs/Pubnub-Android-3.7.2.jar')
compile 'com.google.android.gms:play-services:7.0.0'
compile 'org.roboguice:roboguice:3.+'
provided 'org.roboguice:roboblender:3.+'
compile 'com.google.code.findbugs:jsr305:1.3.9'
}
My gradle.properties
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.configureondemand=true
What can I do to speed up the build of the application? If I build only one flavor for debug|release the build took 3 minutes, if I build all in debug and release it is taking more than 3 hours. Most of the time gradle is spending of the DEX tasks.