Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android java.exe finished with non-zero exit value 1 [closed]

Had the same error encountered which was due to conflicting drawable resources. I did a clean project and the error was no longer encountered.


After a lot of surfing, i found out the problem is GC overhead (out of memory). By adding below code to my build.gradle saved my day.

android {

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

}

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


It must have been a problem with my Java install. I removed all traces of Java (C://program files/Java/jdk) and jre folders and reinstalled it from the official page and now it works fine.


Maybe you can change your buildToolsVersion num.

this is my problem:

Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\ProgramTools\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1

my build.gradle:

android {
    compileSdkVersion 23
    buildToolsVersion "24.0.0"

    defaultConfig {
        applicationId "com.pioneers.recyclerviewitemanimation"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

I just change buildToolsVersion to buildToolsVersion "23.0.2" and the problem was solved.


Problem RAM. I had similar message in my Messages Gradle Build

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_45\bin\java.exe'' 
finished with non-zero exit value 1

Why: I didn't have free RAM on my laptop with the OS windows 8.1.

Solution: I closed a few programs that I don't need. After that, I had more free RAM and my project was built in android studio.


In my case, the solution was to close Android Studio and kill the java processs, which was very big (1.2 GB). After this, my project runs normally (OS X Mount Lion, Android Studio 1.2.2, iMac Mid 2011 4GB Ram).


Solution

1.Just clean the project and check its working or not

2.Just Restart android studio after closing all the rubbish tasks

3.If both the above things not working add this in gradle.build file

android {

    dexOptions {
        incremental = true;
        preDexLibraries = false
        javaMaxHeapSize "4g" 
    }

}