Android Studio-Java.exe completed with non-zero exit value 2

When I try to run my application, I get this error: -

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

UPDATED: - Here is my Build.gradle file (Module: app)

 apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion "22.0.1" defaultConfig { applicationId "navigationdrawer.tutecentral.com.navigationdrawer" minSdkVersion 15 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:appcompat-v7:22.1.1' } 

What does it mean?

+5
source share
6 answers

This happened to me when I refactored some class files into a library project, and I had a duplicate class file name. So double check that you have no duplicate names. This also looks like a duplicate of the question: android project: process terminated with nonzero exit value 2

+6
source

I got this error when I used gradle beta to test Vector Asset. This error continued even after I returned to the stable version of gradle version 1.3.0.
The error was fixed after I used Assembly> Clear project

+6
source

Just add the line below depending on your Gradle application

 compile 'com.android.support:multidex:1.0.0' 

and then below the line in defaultConfig

 multiDexEnabled true 
+6
source

Found the same issue today. I fixed this problem by closing other applications to free up more memory to complete the build process.

Upon receiving this error:

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: process command 'C: \ Program Files \ Java \ jdk1.7.0_79 \ bin \ java.exe' completed with a non-zero exit value 2

Use the process explorer to find out the java.exe command-line option, then run the full command in the CMD window to find out what the error message is. Mine contains "HeapDumpOnOutOfMemoryError", so I close other applications to free up more memory, and then the problem is fixed.

+2
source

Try

Build> Clear Project

If it does not work, try uninstalling

 compile fileTree(dir: 'libs', include: ['*.jar']) 

then add lib separately, e.g.

 compile files('libs/jncryptor-1.1.0.jar') 
0
source

Just do this build> Clear project

Works

0
source

All Articles