20

When I try to compile my app I get a following 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_60\bin\java.exe'' finished with non-zero exit value 2

If I get rid of Facebook Android SDK it compiles without a problem.

My build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21 //tried 19 and 22 changing targetSdkVersion and buildToolsVersion accordingly
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "..."
        minSdkVersion 15
        targetSdkVersion 21
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
        }
    }

...

}

dependencies {
    ...
    compile 'com.facebook.android:facebook-android-sdk:3.23.1' //tried older versions as well
}
Michał Klimczak
  • 12,674
  • 8
  • 66
  • 99

2 Answers2

18

First of all you should try to list your dependencies with gradle :MODULE:dependencies Check if there are libraries conflicts ( same library but different version ). In this case i supose you should exclude support library module from Facebook SDK.

compile ('com.facebook.android:facebook-android-sdk:3.23.1'){
        exclude group: 'com.google.android', module: 'support-v4'
    }
Pawel Cala
  • 685
  • 9
  • 14
  • 15 and accept ? why ? this is my error when I put exclude : DSL NOT FOUND EXCLUDE –  Dec 08 '15 at 22:40
0

While using Facebook SDK project library, Pawel's solution worked for me.

However it stopped working after I had migrated to Gradle dependency 'com.facebook.android:facebook-android-sdk:4.1.1'. Tried to rebuild/reopen project but nothing helped.

This worked for me:

compile ('com.facebook.android:facebook-android-sdk:4.1.1') {
    exclude module: 'support-v4'
}
Andrew
  • 490
  • 3
  • 18
  • 1
    this worked for me: `compile ('com.facebook.android:facebook-android-sdk:4.1.1') { exclude module: 'support-v4' }` – Andrew May 14 '15 at 13:22