0

I am trying to incorporate Facebook SDK and Parse SDK, but Android Studio is giving me errors at compile time.

Here is my 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.8.0_51\bin\java.exe'' finished with non-zero exit value 2

Here is my build.gradle file:

dependencies {
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.android.support:design:22.2.1'
    compile 'com.facebook.android:facebook-android-sdk:4.0.0'
    compile files('libs/bolts-android-1.2.0.jar')
    compile files('libs/Parse-1.9.4.jar')
    compile files('libs/ParseFacebookUtilsV4-1.9.4.jar')
}

Similar post: Similar post this too but not a duplicate, as these solutions didn't work for me. I have tried adding this

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}

But this doesn't work, and honestly isn't a good solution. When I remove facebook sdk, my app compiles no problem, but with it nothing works. What am I missing here?

Community
  • 1
  • 1
rosenthal
  • 775
  • 1
  • 11
  • 28

1 Answers1

0

Solved my own question:

Facebook SDK provides a bolts library within it (at least the 4.+.+ does), so the error was coming from compiling Bolts twice.

Here is the new build.gradle file (innermost)

dependencies {
   compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.android.support:design:22.2.1'
    compile 'com.facebook.android:facebook-android-sdk:4.0.0'
    compile files('libs/Parse-1.9.4.jar')
    compile files('libs/ParseFacebookUtilsV4-1.9.4.jar')
}

Also upgraded top-level build.gradle to:

dependencies {
    classpath 'com.android.tools.build:gradle:1.1.2'
}
rosenthal
  • 775
  • 1
  • 11
  • 28