Finished with Non Zero Exit Value 3
Asked Answered
S

5

13

I am trying to run my project, but I keep getting this error:

Error:Execution failed for task ':app:preDexDebug'. 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 3

This is my gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
    applicationId "com.blume.android"
    minSdkVersion 14
    targetSdkVersion 21
    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 project(path: ':endpoints-backend', configuration: 'android-endpoints')
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
compile project(path: ':cloud-backend', configuration: 'android-endpoints')
compile 'javax.persistence:persistence-api:1.0'
compile project(':endpoints-backend')
}

All Help is appreciated.

Sergiosergipe answered 18/4, 2015 at 17:57 Comment(1)
You most likely have a duplicate dependency in one of your compile project(.Quean
H
27

I just change

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

to

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

It resolved my problem

Hutchins answered 19/6, 2015 at 5:46 Comment(3)
It helped me too. You should mark this answer as solution to make people know that it really helps.Turin
In my case this is not working, if i change to "provided" it give me error in some execution of code used by this libs 'httpmime-4.0.1.jar' lib "apache-mime4j-0.6.jar", in ws call. Can any body help for this ?Braddy
Provided means the libs are needed for compilation of the project, but they won't be distributed with it. If your app actually needs the libs (like the apache-mime4j-0.6.jar in the previous comment) and the runtime environment doesn't "provide" it (hence the name), then you have to use compile.Biodynamics
D
57

add this:

android {
    // Other stuffs
    dexOptions {
        javaMaxHeapSize "4g"
    }
}
Domenech answered 9/10, 2015 at 12:59 Comment(4)
After following a lot of solutions , finally this solution helped me. I'll have to check out for drawbacks if any. Thanks.Trunnel
I got this err: Error:Execution failed for task ':app:transformClassesWithDexForGoogleDebug'. > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/bin/java'' finished with non-zero exit value 3 This answer helped me.Downstream
android { defaultConfig {} dexOptions { javaMaxHeapSize "4g" } packagingOptions { } buildTypes { } }Cuss
Any idea why there is nothing in logs regarding heap size? Although it helped.Rachellrachelle
H
27

I just change

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

to

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

It resolved my problem

Hutchins answered 19/6, 2015 at 5:46 Comment(3)
It helped me too. You should mark this answer as solution to make people know that it really helps.Turin
In my case this is not working, if i change to "provided" it give me error in some execution of code used by this libs 'httpmime-4.0.1.jar' lib "apache-mime4j-0.6.jar", in ws call. Can any body help for this ?Braddy
Provided means the libs are needed for compilation of the project, but they won't be distributed with it. If your app actually needs the libs (like the apache-mime4j-0.6.jar in the previous comment) and the runtime environment doesn't "provide" it (hence the name), then you have to use compile.Biodynamics
C
6

Increased the HEAP size to 2g or 4g. Filename: build.gradle

android {
        defaultConfig {}

        dexOptions {
              javaMaxHeapSize "4g"
        }

        packagingOptions {
        }

        buildTypes {
        }
   }
Cuss answered 5/2, 2016 at 12:17 Comment(0)
U
2

Steps:

1.Go to your app build.gradle

2.include the following: dexOptions { javaMaxHeapSize "4g" }

Unaunabated answered 14/6, 2016 at 6:18 Comment(0)
D
1

1. Please check the Below Code For 1. When i am Using Firebase(com.google.firebase:firebase-messaging:10.0.1) and GMS (compile 'com.google.android.gms:play-services:10.0.1' ) then it gives me error

 Error:Execution failed for task ':app:preDexDebug'. 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 3

2. so i have added this line in gradle File `
defaultConfig { multiDexEnabled true } and in dependacies

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

dexOptions {

        javaMaxHeapSize "2g"
    }

3.so Code Working fine For Updated Version. and not working for Kitkat 4.4.2 device reason is Appcompact, Material Design not Working on that.So i have added below line code in gradle file

  aaptOptions {
    additionalParameters "--no-version-vectors"
}

4. And also have dome some changes with menifest file in

 <application
        android:name="android.support.multidex.MultiDexApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

5.Please Check the my Gradle file which working fine For Me you need to do changes .

  apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"


    defaultConfig {
        applicationId "com.xyz.projectName"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dexOptions {
        //if 2g or 4g
        javaMaxHeapSize "2g"
    }
    // important to run code on kitkat
    aaptOptions {
        additionalParameters "--no-version-vectors"
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    // multidex
    compile 'com.android.support:multidex:1.0.0'


    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.android.support:design:25.1.0'
    compile 'com.android.support:recyclerview-v7:25.1.0'

    // ImageLoader
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'

    // Map
    compile 'com.google.android.gms:play-services:10.0.1'
    compile 'com.google.maps.android:android-maps-utils:0.3+'

    // Spinner
    compile 'com.jaredrummler:material-spinner:1.1.0'

    // Volley
    compile 'com.android.volley:volley:1.0.0'

    //Firebase
    compile 'com.google.firebase:firebase-messaging:10.0.1'
    compile 'com.google.firebase:firebase-core:10.0.1'

    //CropImage
    compile project(':CropImage')

}
apply plugin: 'com.google.gms.google-services'
Donnetta answered 21/12, 2016 at 4:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.