错误:无法解析:com.google.android.gms:play-services-measurement:9.2.0

8
在将Google Play Service升级到9.2.0版本后,在执行gradle同步时我遇到了以下错误。
Error:Failed to resolve: com.google.android.gms:play-services-measurement:9.2.0

我该如何解决这个问题?

取消设置中的离线Gradle。 - Bhoomi Zalavadiya
2个回答

16
在项目级别的 build.gradle 文件中,将依赖更新为

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

1
您还需要生成一个新的 google-services.json 文件。 - Rohan

2
通常情况下,您需要执行4个步骤。
  1. Update your local Google Repository. Run Android SDK manager, find Google Repository and update it to the latest version.

  2. In your project level build.gradle add

    dependencies {
        classpath 'com.google.gms:google-services:3.0.0'
        ...
    }
    
  3. In your app level build.gradle add

    dependencies {
       compile 'com.google.android.gms:play-services-gcm:9.2.0'
       compile 'com.google.android.gms:play-services-measurement:9.2.0'
       //or any google library, which you are interested of
       ...
    }
    
  4. In your app level build.gradle add to the bottom of the file

    apply plugin: 'com.google.gms.google-services'
    

1
更新本地的Google存储库对我来说真的很必要。 - BlackPearl
是的,我也遇到了同样的问题,因为本地的Google仓库。我很高兴也能帮到你。 - Michael Katkov

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