java - 无法解析 com.google.gms :google-services:3. 0.0

标签 java android android-studio google-play-services

我读了很多关于这个主题的帖子,但没有人帮助我。 我正在使用 Android Studio 并关注此 guide

这是项目gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'com.google.gms:google-services:3.0.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

这是应用程序 gradle:

apply plugin: 'com.android.application'

    android {
        compileSdkVersion 25
        buildToolsVersion "25.0.1"
        defaultConfig {
            applicationId "com.xyv.appname"
            minSdkVersion 15
            targetSdkVersion 25
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })
        compile 'com.android.support:appcompat-v7:25.0.1'
        compile 'com.android.support:design:25.0.1'
        testCompile 'junit:junit:4.12'
        compile 'com.google.firebase:firebase-core:10.0.1'        
    }
    apply plugin: 'com.google.gms.google-services'

在这里您可以看到我在我的应用中添加了 google-services.json 的位置:

enter image description here

这些是我的 SDK 工具:

enter image description here

有人知道我的错误是什么吗?

提前致谢

最佳答案

你可能需要添加

compile 'com.google.android.gms:play-services:9.6.1'

也在您的应用程序 build.gradle 中。引用:Upgrade to Google Play Services:9.0.0 Error Failed to resolve: com.google.android.gms:play-services-measurement:9.0.0

如果您最近将版本升级到 3.0.0,您应该在 Android SDK 管理器中仔细检查您的机器上是否安装了正确的版本。

关于java - 无法解析 com.google.gms :google-services:3. 0.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41124322/

相关文章:

Android - 获取异常

java - 从 java/android 获取 web api/asp token

java - 如何使用 Spring Boot 使用 JSON 对象数组?

java - 如果发生超时,则使用相同事件自动调用 Lambda

android - 在 Activity 中继承具有上下文的方法

java - Android Studio : Passing multiple values using intent PROVIDES ONLY 1 VALUE?

android - 键盘将 EditText 隐藏在 android 中的 ScrollView 中?

Android Studio 挂了

java - 谷歌云K8s集群中Spring Java资源安全

java - 在 RH 计算机上禁用系统范围内的 Java 大页面