Reputation: 493
I am building an app that needs to connect to a Google app engine backend built in python. However every time i build the app i get this error.
Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_11\bin\java.exe'' finished with non-zero exit value 1
I ran the build with --stacktrace and --info and got this
AGPBI: {"kind":"simple","text":"Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space","sources":[{}]}
AGPBI: {"kind":"simple","text":"Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space","sources":[{}]}
AGPBI: {"kind":"simple","text":"Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space","sources":[{}]}
AGPBI: {"kind":"simple","text":"Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space","sources":[{}]}
AGPBI: {"kind":"simple","text":"Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space","sources":[{}]}
AGPBI: {"kind":"simple","text":"5 errors; aborting","sources":[{}]}
The build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.test.testapp"
minSdkVersion 9
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven {
url 'http://google-api-client-libraries.appspot.com/mavenrepo'
}
mavenCentral()
mavenLocal()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile project(':app:libs:customerapi')
compile([group: 'com.google.api-client', name: 'google-api-client', version: '1.20.0'])
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.google.api-client:google-api-client-android:1.20.0'
compile 'com.android.support:multidex:1.0.1'
}
I have no clue what is happening and could not find a solution.
Upvotes: 0
Views: 783
Reputation: 1318
Add this to your android closure in build.gradle:
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
Answer found on https://groups.google.com/forum/#!topic/adt-dev/r4p-sBLl7DQ
The problem is that java runs out of memory during the gradle compilation. Increasing the heap size will raise the memory ceiling, allowing the compilation to complete successfully. Do you need to increase the heap to 4GB? No. But increasing it solved the problem I was having -- which happened to be the same as the original poster.
Upvotes: 3