I can't seem to fix this error after I add a jar file to the project:
Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
The program runs without the jar file but when I add it, everything builds but it gives me this error when I try to run it. I have searched and tried the following solutions but nothing fixed the error.
why java.exe exit with value 1 in android studio
Error:Execution failed for task ':app:dexDebug'. > comcommand finished with non-zero exit value 2
Android java.exe finished with non-zero exit value 1
Since none of these solutions worked I thought it my be a over 65k method problem so I edited my build.gradle but the problem still exists.
https://developer.android.com/tools/building/multidex.html
This is my build.grade for my app project:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
................
minSdkVersion 15
targetSdkVersion 21
multiDexEnabled = true
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:21.0.3'
compile 'com.android.support:multidex:1.0.0'
compile files('libs/xyz.jar')
}
I don't know how to fix this problem. Any help would be appreciated.
I had this error message (also only when running not building) when attempting to add a plain Java module as a dependency on an Android module. Though it only happened in Android Studio, not from the command line.
I solved it by including the following line in the plain Java module's build.gradle:
sourceCompatibility = 1.7
Note that Android Studio marks this line as not used.
Try clicking on File > Invalidate caches / Restart > Invalidate and Restart. Once it builds, run your project again. It worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With