【问题标题】:Google services ; com.google.gms:google-services:2.1.2 ; failed to resolve services-measurement谷歌服务; com.google.gms:google-services:2.1.2 ;未能解决服务测量
【发布时间】:2016-08-20 11:17:26
【问题描述】:

只是尝试更新到最新的 google play services 9.4.0。如果我将应用程序级别 gradle 中的类路径保留为 2.1.2,这似乎是截至 6 月 3 日的最新版本,link,我得到错误无法解决:

错误:无法解决:com.google.android.gms:play-services-measurement:9.4.0 安装存储库并同步项目

我已经在 SDK 管理器中更新了我的包。 如果我将类路径保留为 3.0.0,即 5 月发布的版本,情况似乎没问题。知道为什么我会在 2.1.2 版本的类路径中出现这样的错误吗?请参阅下面的我的 gradle 文件。 Android Studio 版本:2.1.3。感谢任何帮助。

build.gradle 项目级别:

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

allprojects {
    repositories {
        jcenter()
        mavenLocal()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

build.gradle 应用级别:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.0"

    defaultConfig {
        applicationId "com.example.main.projectone"
        minSdkVersion 18
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'


    compile('com.facebook.android:facebook-android-sdk:4.7.0') {
        exclude module: 'bolts-android'
    }

    compile 'com.android.support:appcompat-v7:24.0.0'

    compile 'com.android.support:design:24.0.0'
    compile 'com.parse:parse-android:1.13.0'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.github.bumptech.glide:okhttp3-integration:1.4.0@aar'
    compile 'com.squareup.okhttp3:okhttp:3.3.1'
    compile 'com.android.support:cardview-v7:24.0.0'
    compile 'com.android.support:support-v4:24.0.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.fasterxml.jackson.core:jackson-annotations:2.8.1'
    compile 'de.hdodenhof:circleimageview:2.1.0'
    compile 'com.android.support:recyclerview-v7:24.0.0'
    compile 'com.firebase:geofire-android:2.0.0'

    compile 'com.google.android.gms:play-services:9.4.0'
    compile 'com.google.firebase:firebase-auth:9.4.0'
    compile 'com.google.firebase:firebase-storage:9.4.0'
}

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

【问题讨论】:

    标签: android-studio gradle google-play-services


    【解决方案1】:

    由于您使用的是 9.4.0 版本,因此您必须使用 google play service plugin v 3.0.0:

    buildscript {
        // ...
        dependencies {
            // ...
            classpath 'com.google.gms:google-services:3.0.0'
        }
    }
    

    检查official documentation 进行设置。

    【讨论】:

    • 感谢加布里埃尔的回复,我同意; firebase 文档提到了 google-services:3.0.0。我想知道为什么 6 月 3 日发布的版本不起作用,即版本 2.1.2,我认为它是最新版本。无论哪种方式,我至少现在都在推进 3.0.0。
    猜你喜欢
    • 1970-01-01
    • 2015-08-12
    • 2015-11-16
    • 1970-01-01
    • 1970-01-01
    • 2020-02-11
    • 1970-01-01
    • 2018-09-22
    • 2019-10-11
    相关资源
    最近更新 更多