找到com.google.android.gms:play-services-gcm:8.3.0,但需要版本8.1.0

Bak*_*123 40 android google-play-services android-studio android-gradle-plugin

我刚刚在Android SDK Manager中将Google Play服务更新到最新版本 - 23.接下来,我将项目中的依赖项更新为: com.google.android.gms:play-services-gcm:8.3.0

但我得到了:

Found com.google.android.gms:play-services-gcm:8.3.0, but version 8.1.0 is needed
Found com.google.android.gms:play-services-gcm:8.3.0, but version 8.1.0 is needed
Found com.google.android.gms:play-services-gcm:8.3.0, but version 8.1.0 is needed
Found com.google.android.gms:play-services-gcm:8.3.0, but version 8.1.0 is needed
Found com.google.android.gms:play-services-gcm:8.3.0, but version 8.1.0 is needed
:app:processDebugGoogleServices FAILED
Error:Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict.
Run Code Online (Sandbox Code Playgroud)

怎么了?你有这个问题吗?

Jef*_*ton 74

在顶级build.gradle文件中,您需要更新要使用的依赖项

classpath 'com.google.gms:google-services:1.5.0-beta2'
Run Code Online (Sandbox Code Playgroud)

额外信息:通过查看JFrog Bintray的条目可以找到最新版本

进一步更新:是的,自从我回答问题后,这已经更新.最新版本是:

classpath 'com.google.gms:google-services:3.0.0'
Run Code Online (Sandbox Code Playgroud)

但是,始终值得按照提供的链接查找最新版本.

  • 真是一团糟!Google服务变得越来越复杂和混乱. (18认同)
  • @ user987760,我们不应该在版本号中使用'+'.Android工作室警告:"避免在版本号中使用+,可能导致不可预测和不可重复的构建." (6认同)
  • 您可以通过https://bintray.com/android/android-tools/com.google.gms.google-services/view查看最新版本的内容. (3认同)
  • 谷歌还没有更新它的文件,Respect @ iNdieboy-Jeff (2认同)

mtr*_*kal 26

8.4.0的工作解决方案(对于以前的版本也可能与此疯狂问题相同)

project build.gradle:

dependencies {
     classpath 'com.android.tools.build:gradle:2.1.2'
     classpath 'com.google.gms:google-services:2.1.2'
}
Run Code Online (Sandbox Code Playgroud)

app/mobile build.gradle

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'android-apt'

android {
    ...
    ...
    ...
}

dependencies {
    // Google Play Services
    compile 'com.google.android.gms:play-services-analytics:8.4.0'
    // another play services in v8.4.0
}

apply plugin: 'com.google.gms.google-services' // why here on end? Because GOOGLE...
Run Code Online (Sandbox Code Playgroud)

警告: 当您apply plugin: 'com.google.gms.google-services'在构建gradle上移动时,它无法编译...

  • 你能解释一下为什么要将这条线移到顶部而不是编译?我试图更新谷歌播放服务版本,我坚持,最后你的解决方案工作,但是什么原因让这个逻辑陷入困境? (2认同)