将com.google.android.gms版本升级至15.0.2

18

我已经更新了Firebase SDK版本,但在更新com.google.android.gms的版本到15.0.2时出现了错误。我尝试使Firebase和Google服务版本相同,但这并不能解决问题。

依赖项

dependencies {
implementation 'com.google.firebase:firebase-messaging:15.0.2'
implementation 'com.android.support:design:26.1.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.firebase:firebase-ads:15.0.1'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'org.parceler:parceler-api:1.1.9'
annotationProcessor 'org.parceler:parceler:1.1.9'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'io.reactivex:rxjava:1.2.3'
implementation 'io.reactivex:rxandroid:1.2.1'
implementation 'com.jakewharton.rxbinding:rxbinding:1.0.0'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
androidTestImplementation 'com.google.code.findbugs:jsr305:3.0.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.2.0'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.4'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
implementation 'com.google.dagger:dagger-android:2.11'
implementation 'com.google.dagger:dagger-android-support:2.11'
// if you use the support libraries
annotationProcessor 'com.google.dagger:dagger-android-processor:2.11'
annotationProcessor 'com.google.dagger:dagger-compiler:2.13'
implementation 'com.google.auto.value:auto-value:1.5.2'
implementation 'com.jakewharton.timber:timber:4.1.2'
implementation 'org.greenrobot:eventbus:3.0.0'
testImplementation 'junit:junit:4.12'
implementation 'com.twitter.sdk.android:twitter:3.1.1'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.simplecityapps:recyclerview-fastscroll:1.0.16'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation project(':linkedin-sdk')
implementation 'com.azoft.carousellayoutmanager:carousel:1.2.1'
implementation 'com.android.support:multidex:1.0.2'
implementation 'gun0912.ted:tedpermission:2.1.0'
implementation project(':libphonenumber-5.9')
implementation 'com.facebook.android:facebook-login:4.30.0'
implementation 'com.anjlab.android.iab.v3:library:1.0.44'
implementation 'com.github.bumptech.glide:glide:3.8.0'
implementation 'com.android.support:exifinterface:26.1.0'
}

尝试让com.google.android.gms:play-services-locationcom.google.firebase:firebase-messagingcom.google.firebase:firebase-ads这三个库的版本号都保持一致(15.0.2)。 - Arthur Attout
没有符合版本号为'15.0.2'的'com.google.android.gms:play-services-location'和'com.google.firebase:firebase-ads'的仓库可用,因此它无法工作。 - Ashutosh Shrestha
4个回答

28

尝试以下代码:

1.build.gradle(gradle)

更改:

classpath 'com.google.gms:google-services:3.2.0'

至:
  classpath 'com.google.gms:google-services:3.2.1'

请点击下面的链接:

https://dev59.com/Uek5XIcBkEYKwwoY8eTT#50152496


2
当问题发生时,我正在使用3.1.0版本,我刚刚将所有Firebase包升级到最新版本。将google-services更改为3.2.0解决了我的问题。 此外,我已经添加了以下行到repositories: maven{ url "https://dl.bintray.com/android/android-tools" } - Cedar

4

3

需要运行Android 4.0(冰淇淋三明治)或更高版本,以及Google Play服务15.0.0或更高版本的设备

如果您想使用15.0.2,则需要:

  • 使用最新的gms版本。
  • 升级Android Studio版本。

演示

 dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.google.gms:google-services:3.3.0' 
    }

请阅读Firebase Android Release Notes以获取最新信息。

提示:

最新的SDK版本。

Firebase Core     com.google.firebase:firebase-core:15.0.2
Ads               com.google.firebase:firebase-ads:15.0.0
Analytics         com.google.firebase:firebase-analytics:15.0.2
App Indexing      com.google.firebase:firebase-appindexing:15.0.0
Authentication    com.google.firebase:firebase-auth:15.1.0
Cloud Firestore   com.google.firebase:firebase-firestore:16.0.0
Cloud Functions   com.google.firebase:firebase-functions:15.0.0
Cloud Messaging   com.google.firebase:firebase-messaging:15.0.2

更改后,执行Clean-Rebuild-Run操作。

注意

如果仍然出现相同的问题,则需要DOWNGRADLE版本。 使用12.0.1版本。


使用版本15.0.0 会出现错误:程序类型已存在:com.google.android.gms.internal.measurement.zzabn。 - Ashutosh Shrestha
@AshutoshShrestha 阅读 https://dev59.com/Uek5XIcBkEYKwwoY8eTT#50149536 - IntelliJ Amiya
我正在使用上述SDK版本,但它给了我以下错误信息:“请通过更新google-services插件的版本(最新版本信息可在https://bintray.com/android/android-tools/com.google.gms.google-services/获取),或者更新com.google.android.gms到15.0.2版本来解决版本冲突。” - Ashutosh Shrestha
@AshutoshShrestha https://dev59.com/61UL5IYBdhLWcg3wk4vK#50152261 - IntelliJ Amiya
1
降级到12.0.1版本成功了。谢谢。 - Ashutosh Shrestha
@AshutoshShrestha 我已经更正了答案。请您审核一下。 - IntelliJ Amiya

0

请确认您的版本符合此处链接中的要求。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接