2017-04-05 34 views
11

Tôi đang sử dụng facebook-android-sdk:4.20.+com.android.support thư viện được mâu thuẫn với thông báo lỗi:Facebook android sdk phụ thuộc xung đột

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

Sau đây là phụ thuộc của tôi.

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 chạy một báo cáo phụ thuộc gradle sử dụng: ./gradlew -q dependencies app:dependencies --configuration compile, sau đây là các kết quả cho 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 

Sự kết hợp chính xác của phụ thuộc mà tôi phải sử dụng là gì?

+0

Tôi nghĩ câu trả lời này có thể giúp bạn: http://stackoverflow.com/questions/35354359/gradle-error-after-including-facebook-sdk – PedroHidalgo

Trả lời

14

Trong trường hợp cụ thể của bạn, vấn đề là do sdk facebook có sự phụ thuộc với com.android.support:customtabs:25.0.0 và phiên bản đó cũ và phiên bản hiện tại của thư viện hỗ trợ là 25.2.0.

Như bạn có thể nhìn thấy trên đồ thị phụ thuộc các phiên bản mới hơn của cardview-v7, appcompat-v7 và hỗ trợ-v4 đã được sử dụng, vì vậy bạn có thể thử thêm:

biên dịch 'com.android. support: customtabs: 25.2.0 '

cho các phụ thuộc để phiên bản mới hơn của customtabs cũng được sử dụng bởi sdk facebook.

Câu trả lời này có thể hữu ích cũng: Gradle error after including facebook sdk

+0

giải quyết được sự cố của tôi. cảm ơn bạn. – pess0a

0

Câu trả lời trước đó đã không giải quyết vấn đề của tôi. Nhưng dựa trên phản ứng này Facebook SDK dependency conflict nó hoạt động.

Các vấn đề liên quan