我正在构建一个需要连接到内置python的Google应用程序引擎后端的应用程序。但是,每次我构建应用程序时,都会出现此错误。
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
我用--stacktrace和--info运行了构建,并得到了这个
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":[{}]}
build.gradle文件
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'
}
我不知道发生了什么,也找不到解决方案。
最佳答案
将此添加到build.gradle中的android闭包中:
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
在https://groups.google.com/forum/#!topic/adt-dev/r4p-sBLl7DQ上找到答案
问题是在gradle编译期间java内存不足。增加堆大小将提高内存上限,从而使编译成功完成。您是否需要将堆增加到4GB?不。但是增加它可以解决我遇到的问题-恰好与原始海报相同。
关于android - 任务 ':app:dexDebug'的执行失败。用非零退出值1完成的java.exe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33178224/