Android facebook lib冲突,如何排除冲突?

前端之家收集整理的这篇文章主要介绍了Android facebook lib冲突,如何排除冲突?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
官方facebook sdk lib与 android sdk冲突,特别是:
‘com.android.support:animated-vector-drawables:27.0.1’

摇篮:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "re.tryout123"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
        }
    }
}



repositories {
    maven { url "https://jitpack.io" }
    maven { url 'https://maven.fabric.io/public' }
    maven {
        url 'https://maven.google.com/'
        name 'Google'
    }
}

dependencies {
    compile fileTree(include: ['*.jar'],dir: 'libs')

    compile 'com.android.support:design:26.0.1'
    compile 'com.android.support:appcompat-v7:26.0.1'
    compile 'com.android.support:recyclerview-v7:26.0.1'


    compile ('com.facebook.android:facebook-android-sdk:4.+') {
        //Tryin to exlude the conflicting lib... 
        exclude group: 'com.android.support',module: 'animated-vector-drawable'
    }


    compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true;
    }
}

冲突:

错误文字

All com.android.support libraries must use the exact sasme version
specification (mixing versions can lead to runtime crashes). Found
versions 27.0.1,26.0.1. Examples includes
com.android.support:animated-vector-drawable:27.0.1 and com
android.support:design:26.0.1

如果我删除了facebook导入,冲突就消失了,所以我的问题是如何从facebook的lib中排除动画矢量绘图?

您可以看到我在gradle文件中的尝试但现在已经成功了.

提前致谢.

解决方法

首先在您的应用程序的终端中执行./gradlew应用程序:依赖项,然后您将获得
+--- com.android.support:design:26.0.1
|    +--- com.android.support:support-v4:26.0.1 -> 27.0.1
|    |    +--- com.android.support:support-compat:27.0.1
|    |    |    +--- com.android.support:support-annotations:27.0.1
|    |    |    \--- android.arch.lifecycle:runtime:1.0.0
|    |    |         +--- android.arch.lifecycle:common:1.0.0
|    |    |         \--- android.arch.core:common:1.0.0
|    |    +--- com.android.support:support-media-compat:27.0.1
|    |    |    +--- com.android.support:support-annotations:27.0.1
|    |    |    \--- com.android.support:support-compat:27.0.1 (*)
|    |    +--- com.android.support:support-core-utils:27.0.1
|    |    |    +--- com.android.support:support-annotations:27.0.1
|    |    |    \--- com.android.support:support-compat:27.0.1 (*)
|    |    +--- com.android.support:support-core-ui:27.0.1
|    |    |    +--- com.android.support:support-annotations:27.0.1
|    |    |    \--- com.android.support:support-compat:27.0.1 (*)
|    |    \--- com.android.support:support-fragment:27.0.1
|    |         +--- com.android.support:support-compat:27.0.1 (*)
|    |         +--- com.android.support:support-core-ui:27.0.1 (*)
|    |         +--- com.android.support:support-core-utils:27.0.1 (*)
|    |         \--- com.android.support:support-annotations:27.0.1
|    +--- com.android.support:appcompat-v7:26.0.1 -> 27.0.1
|    |    +--- com.android.support:support-annotations:27.0.1
|    |    +--- com.android.support:support-core-utils:27.0.1 (*)
|    |    +--- com.android.support:support-fragment:27.0.1 (*)
|    |    +--- com.android.support:support-vector-drawable:27.0.1
|    |    |    +--- com.android.support:support-annotations:27.0.1
|    |    |    \--- com.android.support:support-compat:27.0.1 (*)
|    |    \--- com.android.support:animated-vector-drawable:27.0.1
|    |         +--- com.android.support:support-vector-drawable:27.0.1 (*)
|    |         \--- com.android.support:support-core-ui:27.0.1 (*)
|    +--- com.android.support:recyclerview-v7:26.0.1
|    |    +--- com.android.support:support-annotations:26.0.1 -> 27.0.1
|    |    +--- com.android.support:support-compat:26.0.1 -> 27.0.1 (*)
|    |    \--- com.android.support:support-core-ui:26.0.1 -> 27.0.1 (*)
|    \--- com.android.support:transition:26.0.1
|         +--- com.android.support:support-annotations:26.0.1 -> 27.0.1
|         \--- com.android.support:support-v4:26.0.1 -> 27.0.1 (*)
+--- com.android.support:appcompat-v7:26.0.1 -> 27.0.1 (*)
+--- com.android.support:recyclerview-v7:26.0.1 (*)
+--- com.facebook.android:facebook-android-sdk:4.+ -> 4.29.0
|    +--- com.facebook.android:facebook-core:4.29.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
|    |    +--- com.android.support:support-annotations:27.0.1
|    |    \--- com.android.support:support-core-utils:27.0.1 (*)
|    +--- com.facebook.android:facebook-common:4.29.0
|    |    +--- com.facebook.android:facebook-core:4.29.0 (*)
|    |    +--- com.android.support:appcompat-v7:27.0.1 (*)
|    |    +--- com.android.support:cardview-v7:27.0.1
|    |    |    \--- com.android.support:support-annotations:27.0.1
|    |    +--- com.android.support:customtabs:27.0.1
|    |    |    +--- com.android.support:support-compat:27.0.1 (*)
|    |    |    \--- com.android.support:support-annotations:27.0.1
|    |    +--- com.android.support:support-v4:27.0.1 (*)
|    |    \--- com.google.zxing:core:3.3.0
|    +--- com.facebook.android:facebook-login:4.29.0
|    |    +--- com.facebook.android:facebook-core:4.29.0 (*)
|    |    \--- com.facebook.android:facebook-common:4.29.0 (*)
|    +--- com.facebook.android:facebook-share:4.29.0
|    |    +--- com.facebook.android:facebook-core:4.29.0 (*)
|    |    \--- com.facebook.android:facebook-common:4.29.0 (*)
|    +--- com.facebook.android:facebook-places:4.29.0
|    |    \--- com.facebook.android:facebook-core:4.29.0 (*)
|    +--- com.facebook.android:facebook-applinks:4.29.0
|    |    \--- com.facebook.android:facebook-core:4.29.0 (*)
|    \--- com.facebook.android:facebook-messenger:4.29.0
|         \--- com.facebook.android:facebook-core:4.29.0 (*)
\--- com.crashlytics.sdk.android:crashlytics:2.6.8
     +--- com.crashlytics.sdk.android:beta:1.2.5
     |    \--- io.fabric.sdk.android:fabric:1.3.17
     +--- io.fabric.sdk.android:fabric:1.3.17
     +--- com.crashlytics.sdk.android:crashlytics-core:2.3.17
     |    +--- io.fabric.sdk.android:fabric:1.3.17
     |    \--- com.crashlytics.sdk.android:answers:1.3.13
     |         \--- io.fabric.sdk.android:fabric:1.3.17
     \--- com.crashlytics.sdk.android:answers:1.3.13 (*)

通过com.android.support搜索,您可以看到有许多地方使用它与2版本27.0.1和26.0.1.这就是你有警告的原因.要解决这个问题

第一种方式:让你的app只使用26.0.1排除所有com.android.support … 27.0.1的facebook喜欢

compile ('com.facebook.android:facebook-android-sdk:4.+') {
  exclude  group:'com.android.support',module:'support-annotations'
  exclude  group:'com.android.support',module:'support-core-utils'
  exclude  group:'com.android.support',module:'appcompat-v7'
  exclude  group:'com.android.support',module:'customtabs'
  exclude  group:'com.android.support',module:'support-v4'
  exclude  group: 'com.android.support',module:'cardview-v7'
}

排除工作但有问题:缺少cardview-v7和customtabs(因为目前没有库提供cardview-v7和customtabs).所以你需要编译

compile 'com.android.support:cardview-v7:26.0.1'
compile 'com.android.support:customtabs:26.0.1'

第二种方式:让你的app只使用27.0.1

>将compileSdkVersion从26升级到27
>将以下所有编译从26.0.1更新到27.0.1

编译’com.android.support:design:26.0.1′
编译’com.android.support:appcompat-v7:26.0.1′
编译’com.android.support:recyclerview-v7:26.0.1′

你可以通过流程来解决here的类似问题.希望它有所帮助

原文链接:https://www.f2er.com/android/310336.html

猜你在找的Android相关文章