如何解决错误:在项目“应用”中已解决的Google Play服务库依赖性

时间:2019-06-18 20:38:48

标签: android android-gradle build.gradle

我将com.google.android.gms:play-services-ads的依赖关系从 17.2.0 更新为 18.0.0 后,出现以下错误:

ERROR: In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[16.5.
0]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.

Dependency failing: com.google.android.gms:play-services-measurement-api:16.5.0 -> com.google.android.gms:play-services-
measurement-sdk-api@[16.5.0], but play-services-measurement-sdk-api version was 17.0.0.

The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
ifact with the issue.
-- Project 'app' depends onto com.google.android.gms:play-services-ads@18.0.0
-- Project 'app' depends onto com.google.firebase:firebase-analytics@{strictly 16.5.0}
-- Project 'app' depends onto com.google.android.gms:play-services-ads@{strictly 18.0.0}
-- Project 'app' depends onto com.google.android.gms:play-services-measurement-api@{strictly 16.5.0}
-- Project 'app' depends onto com.google.android.gms:play-services-measurement-sdk@{strictly 16.5.0}
-- Project 'app' depends onto com.google.android.gms:play-services-measurement-sdk-api@{strictly 17.0.0}
-- Project 'app' depends onto com.google.firebase:firebase-core@16.0.9
-- Project 'app' depends onto com.google.android.gms:play-services-ads-lite@{strictly 18.0.0}
-- Project 'app' depends onto com.google.firebase:firebase-core@{strictly 16.0.9}

For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep
endency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https://
github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = false }" to your b
uild.gradle file.

成绩

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.github.dimitrisCBR:GradientTextView:1.2'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'androidx.mediarouter:mediarouter:1.0.0'
    implementation 'androidx.exifinterface:exifinterface:1.0.0'
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.browser:browser:1.0.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'dev.dworks.libs:volleyplus:0.1.4'
    implementation 'com.github.clans:fab:1.6.4'
    implementation 'com.github.pedromassango:doubleClick:3.0'
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.github.bumptech.glide:okhttp3-integration:4.9.0'
    implementation 'com.github.bumptech.glide:glide:4.9.0'
    implementation 'com.google.firebase:firebase-core:16.0.9'
    implementation 'com.google.firebase:firebase-messaging:18.0.0'
    implementation 'com.firebase:firebase-jobdispatcher:0.6.0'
    implementation project(':library')
    annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
    implementation 'com.yarolegovich:discrete-scrollview:1.4.9'
    implementation 'com.github.esafirm.android-image-picker:imagepicker:1.12.0'
    implementation 'jp.wasabeef:glide-transformations:4.0.1'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.vodyasov:amr:0.5'
    implementation 'org.apache.commons:commons-lang3:3.9'
    implementation 'com.google.guava:guava:26.0-android'
    testImplementation 'junit:junit:4.12'
    implementation 'de.hdodenhof:circleimageview:3.0.0'
    implementation 'androidx.palette:palette:1.0.0'
    implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.15'
    implementation 'com.google.android.exoplayer:exoplayer:2.10.1'
    implementation 'com.squareup:otto:1.3.8'
    implementation 'org.apache.commons:commons-collections4:4.3'
    implementation 'org.greenrobot:eventbus:3.1.1'
    implementation 'io.github.inflationx:calligraphy3:3.1.1'
    implementation 'io.github.inflationx:viewpump:2.0.2'
    implementation 'com.google.android.gms:play-services-ads:18.0.0'
}
apply plugin: 'com.google.gms.google-services'

1 个答案:

答案 0 :(得分:2)

您的Gradle文件中的依赖项似乎存在版本冲突。

请检查Release Notes June 17, 2019来查找它们。

  

在maven.google.com上发布的工件
  com.google.android.gms:play-services-ads:18.0.0
  com.google.firebase:firebase-core: 17.0.0
  com.google.firebase:firebase-messaging: 19.0.0

在您的代码中,与Firebase相关的代码似乎基于May 07, 2019版本。

implementation 'com.google.android.gms:play-services-ads:18.0.0'
implementation 'com.google.firebase:firebase-core:16.0.9' // old
implementation 'com.google.firebase:firebase-messaging:18.0.0' // old