why java.exe exit with value 1 in android studio

后端 未结 10 1123
有刺的猬
有刺的猬 2020-12-04 01:22

Error:Execution failed for task \':app:dexDebug\'.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process

相关标签:
10条回答
  • 2020-12-04 02:20

    upgraded gradle version

    classpath 'com.android.tools.build:gradle:1.1.2'
    

    and updated android studio worked

    0 讨论(0)
  • 2020-12-04 02:20

    Let me talk about my story. I had Ubuntu 14.04 installed in Virtual Box, and i tried to run gradle task ./gradlew assembleDebug to compile my project, which uses git as version control system. Unfortunately, each time unexpectedly stopped for no specific reason, except the following error log:

    *…
    

    :dexDebug FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':dexDebug'.

    com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero exit value 1*

    Googling for days, tried every possible solutions, I still failed to build. Then I tried to comment out multiDexEnabled in the build.gradle file, this time gradle gave a bit more useful tip: "build stopped as too many translation errors", something like this. Then I ran git status and found many error logs, as shown below:

    error logs

    furthermore, the number of the error log files are almost the same as the number of build failure times. That's it! each build failure generated an error log file!

    check one of the error log, hs_err_pid3143.log, and ensure that the build failures were caused by insufficient memories.

    insufficient memory.

    So the solution is relatively easy:

    1. Shut down Ubuntu OS in VirtualBox.
    2. Enlarge base memory from 4G to 6G, and Restart Ubuntu OS in VirtualBox.

    Note: generally, dexDebug task will eat most of the memory. in my case, the base memory in VirtualBox was 4GB before changing to 6GB, and javaMaxHeapSize had been set to "4g", it still failed.

    dexOptions {
        javaMaxHeapSize "4g"
    }
    

    Sometime building is not so easy, hopefully my post helps.

    0 讨论(0)
  • 2020-12-04 02:21

    I just add these lines and it works. You can try but not sure it will solve your problem.

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_6
        targetCompatibility JavaVersion.VERSION_1_6
    }
    
    0 讨论(0)
  • 2020-12-04 02:22

    I have the same problem. It heppends when your "C" drive has no free place. Just clear "C" drive and restart Android Studio. Sorry for my English.

    0 讨论(0)
提交回复
热议问题