2016-10-23 90 views
0

我試圖在使用Maven回購的項目中包含JWPlayer。問題是圖書館的衝突與com.google.android.gms:play-services-auth:9.6.1Android JWPlayer與Play服務發生衝突

錯誤消息:

All com.google.android.gms libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 9.6.1, 8.3.0. Examples include com.google.android.gms:play-services-basement:9.6.1 and com.google.android.gms:play-services-ads:8.3.0 

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

我嘗試使用以下行排除庫,但沒有奏效

compile ('com.longtailvideo.jwplayer:jwplayer-android-sdk:+') { 
    exclude module('com.google.android.gms:play-services-auth:8.3.0') 
} 

任何想法如何解決這個問題?

的build.gradle內容:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 25 
    buildToolsVersion "24.0.2" 

    defaultConfig { 
     applicationId "xxxxxxxxxxxxx" 
     minSdkVersion 19 
     targetSdkVersion 25 
     versionCode 1 
     versionName "1.0" 
    } 

    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 

    dataBinding { 
     enabled = true 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.android.support:appcompat-v7:25.0.0' 
    compile 'com.android.support:design:25.0.0' 
    compile 'com.google.firebase:firebase-core:9.6.1' 
    compile 'com.google.firebase:firebase-database:9.6.1' 
    compile 'com.google.firebase:firebase-crash:9.6.1' 
    compile 'com.google.firebase:firebase-auth:9.6.1' 
    compile 'com.google.firebase:firebase-messaging:9.6.1' 
    compile 'com.google.android.gms:play-services-auth:9.8.0' 
    compile 'com.facebook.android:facebook-android-sdk:4.15.0' 
    compile 'com.squareup.picasso:picasso:2.5.2' 
    compile 'com.google.android.exoplayer:exoplayer:r2.0.1' 
    compile ('com.longtailvideo.jwplayer:jwplayer-android-sdk:+'){ 
     exclude group: 'com.android.support' 
     exclude group: 'com.google.android.gms' 
    } 
} 

apply plugin: 'com.google.gms.google-services' 

回答

2

首先,你必須閱讀jwplayer的pom:那裏你可以找到你所依賴的相關性的列表。然後你可以決定排除這些模塊:

compile ('com.longtailvideo.jwplayer:jwplayer-android-sdk:+') { 
    exclude module: 'appcompat-v7' 
    exclude module: 'play-services-ads' 
} 

或團體:

compile ('com.longtailvideo.jwplayer:jwplayer-android-sdk:+') { 
    exclude group: 'com.android.support' 
    exclude group: 'com.google.android.gms' 
} 

或一組的模塊:

compile ('com.longtailvideo.jwplayer:jwplayer-android-sdk:+') { 
    exclude group: 'com.android.support', module: 'appcompat-v7' 
    exclude group: 'com.google.android.gms', module: 'play-services-ads' 
} 

根據您的需要。

+0

很滿意pom的建議,真的很有幫助!問題是構建仍然失敗,出現另一個錯誤:'錯誤:執行任務失敗':app:processDebugGoogleServices'。 >請通過更新google-services插件的版本或將com.google.android.gms的版本更新爲9.6.1來修復版本衝突。「任何想法爲什麼? –

+0

是的,我嘗試了以上所有 –

+0

我已經發布build.gradle內容 –

相關問題