Finished with Non Zero Exit Value 3

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

  • Setting textSize programmatically
  • How to check a file's existence in phone directory with phonegap
  • Using the Android Application class to persist data
  • Rotate animation android
  • Lollipop: Disabled button --> which style?
  • Android: How to override onBackPressed() in AlertDialog?
  • 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.

  • Insert Contact (ContactsContract) via Intent with Image (Photo)
  • play store alpha test download link not working
  • What is the integer value that gives a broadcast receiver highest priority?
  • integrating org.apache.poi and the javax.xml.stream.* package (stax-api) in android - how to set the --core-library argument in Android Studio?
  • Does the Android ART runtime have the same method limit limitations as Dalvik?
  • Difference between Adapter and Loader in Android
  • 6 Solutions collect form web for “Finished with Non Zero Exit Value 3”

    I just change

    compile fileTree(dir: ‘libs’, include: [‘*.jar’])”

    to

    provided fileTree(dir: ‘libs’, include: [‘*.jar’])”.

    It resolved my problem

    add this:

    android {
        // Other stuffs
        dexOptions {
            javaMaxHeapSize "4g"
        }
    }
    

    Increased the HEAP size to 2g or 4g.

    android {
            defaultConfig {}
    
            dexOptions {
                  javaMaxHeapSize "4g"
            }
    
            packagingOptions {
            }
    
            buildTypes {
            }
       }
    

    Steps:

    1.Go to your app build.gradle

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

    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'
    

    I am just change

    “compile fileTree(dir: ‘libs’, include: [‘*.jar’])”

    To

    provided fileTree(dir: ‘libs’, include: [‘*.jar’])

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.