Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android project: process finished with non-zero exit value 2

I'm unable to compile my android project. Google and other SO posts tell me it (probably) has something to do with dependencies, but I can't find where. Here's the error:

Error:Gradle: 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

and my gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.example.skate.socialskate"

        minSdkVersion 21
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.google.android.gms:play-services:7.3.0'
    compile 'com.google.apis:google-api-services-youtube:v3-rev136-1.20.0'
    compile 'com.android.support:cardview-v7:22.1.0'
    compile 'com.android.support:recyclerview-v7:21.0.+'
    compile 'de.hdodenhof:circleimageview:1.2.1'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.2.+'
    compile 'com.fasterxml.jackson.core:jackson-core:2.2.+'
    compile 'com.fasterxml.jackson.core:jackson-annotations:2.2.+'
    compile 'org.jsoup:jsoup:1.8.2'
    compile 'com.github.shell-software:fab:1.1.0'
    compile 'com.google.api-client:google-api-client:1.18.0-rc'



}
like image 432
HaruhiNishikawa Avatar asked May 19 '15 08:05

HaruhiNishikawa


2 Answers

This happened for me when I was refactoring some class files to a library project and I had a duplicate name of a class file. So, double check that you do not have any duplicate names.

like image 127
cdwheatley Avatar answered Oct 13 '22 22:10

cdwheatley


Android Studio suggests,

Avoid using + in version numbers can lead to unpredictable and unrepeatable builds.

+ in dependencies lets you pick up automatically the latest available version rather than a specific one, however this is not recommended.

You may have tested with a slightly different version than what build server used.

After Removing Plus Sign and Adding a Specific Version problem was solved in my case.

like image 26
Palak Avatar answered Oct 13 '22 23:10

Palak