添加play-services-auth 16.0.1后在gradle上发出警告

时间:2019-04-17 03:35:05

标签: android android-studio gradle android-gradle

在添加play-services-auth版本16.0.1以在我的android应用上实现google登录后,我收到警告,而库不兼容。警告是关于混合版本:

com.android.support:animated-vector-drawable:28.0.0 and com.android.support:support-media-compat:26.1.0 

这是我的build.gradle文件中的相关部分:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.loopj.android:android-async-http:1.4.9'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:support-vector-drawable:28.0.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
}

我没有使用com.android.support:support-media-compat:26.1.0,所以我不明白原因。

1 个答案:

答案 0 :(得分:2)

您使用media-compat,但不是直接使用,您的依赖项使用它,您可以通过排除以下内容来对其进行修复:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0', {
        exclude group: 'com.android.support', module: 'support-media-compat:26.1.0'
    }
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.loopj.android:android-async-http:1.4.9'
    implementation 'com.android.support:design:28.0.0', {
        exclude group: 'com.android.support', module: 'support-media-compat:26.1.0'
    }
    implementation 'com.android.support:support-vector-drawable:28.0.0', {
        exclude group: 'com.android.support', module: 'support-media-compat:26.1.0'
    }
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2', {
        exclude group: 'com.android.support', module: 'support-media-compat:26.1.0'
    }
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:recyclerview-v7:28.0.0', {
        exclude group: 'com.android.support', module: 'support-media-compat:26.1.0'
    }
}

此外,您可以通过在终端中执行以下命令来研究所有依赖项:

./gradlew app:dependencies

其中app-是您的模块名称