Android studio java.exe finished with non-zero exit value 3

爷,独闯天下 提交于 2019-11-30 13:09:45

When your project contains large number of classes, android studio will throw out non-zero exit value 3 error.

To solve the error, add this in build.gradle file and sync project with gradle.

dexOptions {
    javaMaxHeapSize "4g"
}

FIXED SOLUTION: Increased the HEAP size to 2g or 4g.

android {
    defaultConfig {}

    dexOptions {
        javaMaxHeapSize "4g"
    }

    packagingOptions {
    }

    buildTypes {
    } }

I have the same issue almost every day, and I always get rid of it by clearing and rebuilding the project. The worst case is restarting Android Studio.

In my case, it seems to happen when running low on memory. I run Android Studio on a Windows 7 with 8 GB RAM, and every time the total RAM usage gets near 6 GB I get the same error code or a different one ("java.exe finished with non-zero exit value 1").

Closing some or all other programs (such as Internet browser, Android emulator) always solve the problem for me.

I fixed my issue with: android{ dexOptions { javaMaxHeapSize "4g" } } try will make fix even you issue. I hope so..

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!