Reputation: 87
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.
Upvotes: 2
Views: 1340
Reputation: 10269
EDIT: Jack and Jill are deprecated and are no longer supported!
Maybe you could try the new experimental android toolchain Jack and Jill: http://tools.android.com/tech-docs/jackandjill
Upvotes: 1
Reputation: 18243
This has been around for some time now.
Unfortunately, android studio's make seems to perform a clean every single time, causing the previously DEX'd files to be deleted.
AFAIK you cannot do more than what you already did. It is something Google should work on (regarding the DEX phase).
See related: Building and running app via Gradle and Android Studio is slower than via Eclipse
Upvotes: 1
Reputation: 2473
If you're using Android Studio the easiest solution is to go to Preferences -> Gradle
and enable Offline Work
Upvotes: 3