首页 > 解决方案 > 如何将所有谷歌依赖项设置为兼容版本?

问题描述

以下是我的构建 Gradle 依赖项,它有效。

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:design:28.0.0'
    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 files('libs/jama-1.0.2.jar')
    implementation files('libs/la4j-0.4.5.jar')
    //implementation group: 'org.ejml', name: 'ejml-all', version: '0.37.1'
    //implementation group: 'org.openimaj', name: 'openimaj', version: '1.3.1', ext: 'pom'
    implementation group: 'org.apache.commons', name: 'commons-math3', version: '3.0'
    //implementation 'com.google.android.gms:play-services-ads:18.3.0'
    //implementation 'com.google.android.gms:play-services-ads:19.3.0'

}

但是当我尝试添加以下依赖项时:

implementation 'com.google.android.gms:play-services-ads:19.3.0

我收到以下错误。

implementation 'com.android.support:appcompat-v7:28.0.0'

我查看了另一个类似问题的答案,该问题要求使所有谷歌依赖版本兼容。但是不知道哪个版本兼容什么?有没有办法知道这一点?

标签: androiddependencies

解决方案


您可以supportplay-services-ads

implementation('com.google.android.gms:play-services-ads:19.3.0') {
        exclude group: 'com.android.support'
}

推荐阅读