Skip to content Skip to sidebar Skip to footer

Gradle Error After Including Facebook Sdk

Immediately after adding the facebook-audience-network-sdk in my gradle file, I started getting errors, the first one I fixed my adding multiDexEnabled true, after that I keep gett

Solution 1:

I finally got rid of the error. So the problem was with the com.google.android.gms:play-services-ads-8.1.0. You can see from the image it was 8.1.0 and other play dependencies were 8.4.0.

So these two ways worked. One was to change the dependency into

 compile ('com.facebook.android:facebook-android-sdk:4.10.0'){
    exclude group:"com.google.android.gms"
 }

But the issue with this is that, it could be a problem since in my other dependencies I didn't have play-services-ads:8.4.0'

So the way I solved this was just add a single line

  compile 'com.google.android.gms:play-services-ads:8.4.0'

This way everything worked perfectly, because when gradle compiled it automatically replaced the 8.1.0 into the 8.4.0

Here is my final dependencies list that worked

dependencies {
     compile fileTree(dir: 'libs', include: ['*.jar'])
     testCompile 'junit:junit:4.12'
     compile 'com.android.support:appcompat-v7:23.1.1'
     compile 'com.mcxiaoke.volley:library:1.0.17'
     compile 'com.android.support:recyclerview-v7:23.1.1'
     compile 'com.android.support:design:23.1.1'

     compile 'com.google.android.gms:play-services-gcm:8.4.0'
     compile 'com.google.android.gms:play-services-auth:8.4.0'
     compile 'com.google.android.gms:play-services-analytics:8.4.0'

     compile 'com.google.android.gms:play-services-ads:8.4.0'

     compile 'com.facebook.android:facebook-android-sdk:4.10.0'
     compile 'com.facebook.android:audience-network-sdk:4.10.0'
     compile 'joda-time:joda-time:2.7'

}


Post a Comment for "Gradle Error After Including Facebook Sdk"