Android JWPlayer 与 Play 服务冲突

Android JWPlayer conflicts with Play Services

我正在尝试使用 Maven 存储库将 JWPlayer 包含在我的项目中。问题是库与 com.google.android.gms:play-services-auth:9.6.1

冲突

错误信息:

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'

首先你必须阅读 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'
}

根据您的需要。