Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook android sdk dependency conflict

I am using facebook-android-sdk:4.20.+ and com.android.support libraries which are conflicting with error message:

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 25.2.0, 25.0.0. Examples include com.android.support:animated-vector-drawable:25.2.0 and com.android.support:customtabs:25.0.0 less... (⌘F1) 
There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion.)

Following are my dependencies.

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile files('libs/YouTubeAndroidPlayerApi.jar')

    compile 'com.android.support:appcompat-v7:25.2.0'
    compile 'com.android.support:customtabs:25.0.0'
    compile 'com.android.support:design:25.+'
    compile 'com.android.support:cardview-v7:25.+'
    compile 'com.android.support:recyclerview-v7:25.+'
    compile 'com.fasterxml.jackson.core:jackson-core:2.7.4'
    compile 'com.fasterxml.jackson.core:jackson-annotations:2.7.4'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.7.4'
    compile 'org.jsoup:jsoup:1.8.3'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'commons-io:commons-io:2.4'
    compile 'com.google.android.gms:play-services-analytics:10.0.1'
    compile 'com.facebook.android:facebook-android-sdk:4.+'
    testCompile 'junit:junit:4.12'
}

On running a gradle dependency report using: ./gradlew -q dependencies app:dependencies --configuration compile, following are the results for facebook-android-sdk.

+--- com.facebook.android:facebook-android-sdk:4.+ -> 4.20.0
|    +--- com.android.support:support-v4:25.0.0 -> 25.2.0 (*)
|    +--- com.android.support:appcompat-v7:25.0.0 -> 25.2.0 (*)
|    +--- com.android.support:cardview-v7:25.0.0 -> 25.2.0 (*)
|    +--- com.android.support:customtabs:25.0.0
|    |    +--- com.android.support:support-compat:25.0.0 -> 25.2.0 (*)
|    |    \--- com.android.support:support-annotations:25.0.0 -> 25.2.0
|    \--- com.parse.bolts:bolts-android:1.4.0
|         +--- com.parse.bolts:bolts-tasks:1.4.0
|         \--- com.parse.bolts:bolts-applinks:1.4.0
|              \--- com.parse.bolts:bolts-tasks:1.4.0

What is the right combination of dependencies that I must use?

like image 273
jay Avatar asked Apr 05 '17 07:04

jay


People also ask

What can I do with the Facebook SDK for Android?

The Facebook SDK for Android gives you access to the following features: Facebook Login — A secure and convenient way for people to log into your app or website by using their Facebook credentials. Sharing — Enable people to post to Facebook from your app.

How to add Firebase Analytics SDK to Unity Project?

Import the latest Firebase Analytics SDK 6.10.0 into the project. Import Unity Jar Resolver v1.2.135 into the project. Enable mainTemplate.gradle (Player settings -> publishing settings -> check custom gradle template) Download and open the repro project I made. If I build with just Facebook SDK, it works.

Why doesn't Facebook SDK work with edm4u?

Facebook SDK is injecting old dependencies that clash with androidX and EDM4U is not able to solve them. Facebook added cardview and another local plugin added it also. Jetifier seems to do nothing.

What are the latest versions of unity and Firebase SDK?

Sign in to your account Unity Editor Version: 2019.3.0f6 Unity SDK Version: 7.18.0 and 7.18.1 Firebase SDK Version: 6.10.0 Unity Jar Resolver Version: 1.2.135


1 Answers

In your specific case the problem is because the facebook sdk has a dependency with com.android.support:customtabs:25.0.0 and that version is old and your current version of the support library is 25.2.0.

As you can see on the dependency graph the newer versions of cardview-v7, appcompat-v7 and support-v4 are already being used, so you can try adding:

compile 'com.android.support:customtabs:25.2.0'

to the dependencies so that the newer version of customtabs is used also by the facebook sdk.

This answer could be useful also: Gradle error after including facebook sdk

like image 185
Pedro Hidalgo Avatar answered Nov 09 '22 19:11

Pedro Hidalgo