首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Android java.exe以非零退出值1结束

Android java.exe以非零退出值1结束
EN

Stack Overflow用户
提问于 2015-03-14 11:31:56
回答 23查看 241.3K关注 0票数 118

我尝试过类似的方法,但没有一个解决方案有效。我以前运行应用程序没有问题,但我的新应用程序突然开始给我带来问题。当我尝试运行它时,它总是失败,我说:

代码语言:javascript
复制
Error:Execution failed for task ':app:preDexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files (x86)\Java\jdk1.7.0_67\bin\java.exe'' finished with non-zero exit value 1

以下是控制台显示的内容:

代码语言:javascript
复制
Executing tasks: [:app:assembleDebug]

Configuration on demand is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportSupportV42200Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:compileDebugJava UP-TO-DATE
:app:preDexDebug
AGPBI: {"kind":"SIMPLE","text":"Error: Could not create the Java Virtual        Machine.","position":{},"original":"Error: Could not create the Java Virtual Machine."}
AGPBI: {"kind":"SIMPLE","text":"Error: A fatal exception has occurred. Program will exit.","position":{},"original":"Error: A fatal exception has occurred. Program will exit."}

AGPBI: {"kind":"SIMPLE","text":"Error: Could not create the Java Virtual Machine.","position":{},"original":"Error: Could not create the Java Virtual Machine."}
AGPBI: {"kind":"SIMPLE","text":"Error: A fatal exception has occurred. Program will exit.","position":{},"original":"Error: A fatal exception has occurred. Program will exit."}


FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:preDexDebug'.
com.android.ide.common.process.ProcessException:     org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files (x86)\Java\jdk1.7.0_67\bin\java.exe'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 2.614 secs

AGPBI: {"kind":"SIMPLE","text":"Error: Could not create the Java Virtual Machine.","position":{},"original":"Error: Could not create the Java Virtual Machine."}
AGPBI: {"kind":"SIMPLE","text":"Error: A fatal exception has occurred. Program will exit.","position":{},"original":"Error: A fatal exception has occurred. Program will exit."}

这个应用程序非常简单,我没有改变它从股票布局太多。它是专为棒棒糖设计的,并且只使用普通功能。下面是build.gradle:

代码语言:javascript
复制
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.0"

defaultConfig {
    applicationId "com.package.app"
    minSdkVersion 21
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:22.0.0'
}
EN

回答 23

Stack Overflow用户

回答已采纳

发布于 2015-03-29 23:59:11

一定是我的Java安装出了问题。我删除了Java (C://program files/Java/jdk)和jre文件夹的所有痕迹,并从official page重新安装了它,现在它工作得很好。

票数 13
EN

Stack Overflow用户

发布于 2015-04-06 00:11:50

遇到了相同的错误,这是由于冲突的可提取资源。我做了一个干净的项目,不再遇到这个错误。

票数 56
EN

Stack Overflow用户

发布于 2015-12-18 20:14:02

经过大量的冲浪,我发现问题出在GC开销(内存不足)。通过将下面的代码添加到我的build.gradle中,我节省了一天。

代码语言:javascript
复制
android {

    dexOptions {
        incremental = true;
        preDexLibraries = false
        javaMaxHeapSize "4g" // 2g should be also OK
    }

}

参考- ProcessException: org.gradle.process.internal.ExecException finished with non-zero exit value 2

票数 16
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29045129

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档