Android JWPlayer与Play服务冲突

时间:2016-10-23 12:29:41

标签: android android-gradle jwplayer

我正在尝试使用Maven repo在我的项目中包含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'

1 个答案:

答案 0 :(得分: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'
}

取决于您的需求。