簡體   English   中英

無法解析 com.google.gms:google-services:3.0.0

[英]Could not resolve com.google.gms:google-services:3.0.0

我閱讀了很多關於這個主題的帖子,但沒有人幫助我。 我正在使用 Android Studio 並遵循本指南

這是項目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 的位置:

在此處輸入圖片說明

這些是我的 SDK 工具:

在此處輸入圖片說明

有人明白我的錯誤是什么嗎?

先感謝您

您可能需要添加

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

在您的應用程序 build.gradle 中。 參考: 升級到 Google Play 服務:9.0.0 錯誤無法解決:com.google.android.gms:play-services-measurement:9.0.0

如果您最近將版本提高到 3.0.0,您應該在 Android SDK 管理器中仔細檢查您的機器上是否安裝了正確的版本。

打開獨立的 SDK Manager,在 Extras 部分你會發現“Google Play Services”更新它。

在此處輸入圖片說明

我通過將 android studio 更新到 2.3 beta 2 解決了我的問題我只是更新了一個 android studio,一切都在破壞

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM