We have changed our Android app project to use gradle, but have noticed it is building significantly slower.
Before with ANT:
6 sek / 50 sec (with clean)
After with gradle:
30 sek / 80 sec (with clean)
I have profiled the solution with:
gradle assembleDebug --profile
The main tasks in the resulting report was thies tasks: (in the build without clean)
:packageDebug 10.690s
:processDebugResources 8.795s
:compileDebugJava 7.644s
I don't have any ideas about getting more details information about thies tasks.
Is this normal? How could this be improved?
I know the new build system is still in betas, but it seems like others are building much faster.
I have looked around without finding a solution I have tried several things including making sure gradle deamon is enabled with a gradle.properties file containing this:
org.gradle.daemon=true
org.gradle.jvmargs=-Xms128m -Xmx256m
org.gradle.parallel=true
build.gradle:
buildscript {
repositories {
mavenCentral()
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
classpath 'com.google.guava:guava:14.0.1'
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
classpath 'me.tatarka:gradle-retrolambda:1.1.1'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.2'
}
}
repositories {
mavenCentral()
maven { url 'http://download.crashlytics.com/maven' }
}
apply plugin: 'android'
apply plugin: 'crashlytics'
apply plugin: 'retrolambda'
apply plugin: 'android-apt'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.google.guava:guava:14.0.1'
compile 'com.crashlytics.android:crashlytics:1.+'
apt "org.androidannotations:androidannotations:3.0.1"
compile "org.androidannotations:androidannotations-api:3.0.1"
}
apt {
arguments {
resourcePackageName "com.example"
androidManifestFile variant.processResources.manifestFile
}
}
android {
packagingOptions { //Fix: http://stackoverflow.com/a/20675331/860488
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
compileSdkVersion 10
buildToolsVersion "18.0.1"
defaultConfig {
minSdkVersion 7
targetSdkVersion 10
buildConfigField "boolean", "useProductionServices", "true"
}
buildTypes {
testflight.initWith(buildTypes.debug)
debug {
packageNameSuffix ".debug"
buildConfigField "boolean", "useProductionServices", "false"
}
testflight {
packageNameSuffix ".testflight"
buildConfigField "boolean", "useProductionServices", "true"
}
release {
buildConfigField "boolean", "useProductionServices", "true"
}
}
}
retrolambda {
compile "net.orfjackal.retrolambda:retrolambda:1.1.2"
jdk System.getenv("JAVA8_HOME")
}