【问题标题】:Facebook android sdk dependency conflictFacebook android sdk依赖冲突
【发布时间】:2017-04-05 07:19:01
【问题描述】:

我正在使用与错误消息冲突的 facebook-android-sdk:4.20.+com.android.support 库:

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.)

以下是我的依赖项。

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'
}

在使用 ./gradlew -q dependencies app:dependencies --configuration compile 运行 gradle 依赖关系报告时,以下是 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

我必须使用的正确依赖组合是什么?

【问题讨论】:

标签: android facebook gradle android-gradle-plugin android-facebook


【解决方案1】:

在您的具体情况下,问题是因为 facebook sdk 与 com.android.support:customtabs:25.0.0 有依赖关系,并且该版本是旧版本,而您当前的支持库版本是 25.2.0

正如你在依赖图中看到的,cardview-v7、appcompat-v7 和 support-v4 的较新版本已经在使用,所以你可以尝试添加:

编译'com.android.support:customtabs:25.2.0'

到依赖项,以便 facebook sdk 也使用较新版本的 customtabs。

这个答案也可能有用:Gradle error after including facebook sdk

【讨论】:

    【解决方案2】:

    上一个答案没有解决我的问题。但根据Facebook SDK dependency conflict 的回复,它可以工作。

    【讨论】:

      猜你喜欢
      • 2018-02-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多