Android 找不到com.google.gms:google services:4.0.1

Android 找不到com.google.gms:google services:4.0.1,android,firebase-cloud-messaging,google-play-services,Android,Firebase Cloud Messaging,Google Play Services,嗨,我用android启动了一个新项目,并按照谷歌文档中的说明导入了firebase。 Android studio 3.0.1中的一切都非常完美。 现在我将Android studio更新为3.2.1。现在,同样的代码正在重建,并得到了错误消息 找不到com.google.gms:google services:4.0.1 日志为: Could not find com.google.gms:google-services:4.0.1. Searched in the following lo

嗨,我用android启动了一个新项目,并按照谷歌文档中的说明导入了firebase。 Android studio 3.0.1中的一切都非常完美。 现在我将Android studio更新为3.2.1。现在,同样的代码正在重建,并得到了错误消息

找不到com.google.gms:google services:4.0.1

日志为:

Could not find com.google.gms:google-services:4.0.1.
Searched in the following locations:
    file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/google/gms/google-services/4.0.1/google-services-4.0.1.pom
    file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/google/gms/google-services/4.0.1/google-services-4.0.1.jar
    https://jcenter.bintray.com/com/google/gms/google-services/4.0.1/google-services-4.0.1.pom
    https://jcenter.bintray.com/com/google/gms/google-services/4.0.1/google-services-4.0.1.jar
    https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.0.1/google-services-4.0.1.pom
    https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.0.1/google-services-4.0.1.jar
Required by:
    project :
我的项目级别为:

buildscript {

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

allprojects {
    repositories {
        jcenter()
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.arafa.sms"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.0'
    implementation 'com.android.support:support-v4:27.1.0'
    implementation 'com.android.support:animated-vector-drawable:27.1.0'
    implementation 'com.android.support:support-media-compat:27.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.code.gson:gson:2.6.2'
    implementation 'com.squareup.okhttp3:okhttp:3.3.1'
    implementation 'com.google.firebase:firebase-core:16.0.1'
}
apply plugin: 'com.google.gms.google-services'
应用程序级别的渐变是:

buildscript {

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

allprojects {
    repositories {
        jcenter()
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.arafa.sms"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.0'
    implementation 'com.android.support:support-v4:27.1.0'
    implementation 'com.android.support:animated-vector-drawable:27.1.0'
    implementation 'com.android.support:support-media-compat:27.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.code.gson:gson:2.6.2'
    implementation 'com.squareup.okhttp3:okhttp:3.3.1'
    implementation 'com.google.firebase:firebase-core:16.0.1'
}
apply plugin: 'com.google.gms.google-services'

这里有什么问题!请帮帮我

我也有同样的问题,谷歌回购似乎缺少这种依赖性。我检查了和gms文件夹不包含任何已发布版本

因此,作为一个快速修复,我添加了另一个存储库:

repositories {
    maven { url 'https://dl.bintray.com/android/android-tools' }
}

<强>编辑:,因为这只是一个<强>临时解决方案,我认为它是一个解决方案,所以我能够继续开发。稍后,当Google repository包含依赖项或我们知道他们将其移动到何处时,我将删除此依赖项。

尝试将另一个maven存储库添加到您的project gradle文件中。例如:

allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://jitpack.io" }
    }
}
如果这不起作用,添加OneSignal gradle插件(也添加到项目的gradle中)可能会奏效()


我也有同样的问题。可能与类似的问题有关-对我来说,它也找不到com.google.firebase:firebase plugins:1.1.5了,不得不添加这个repo:maven{url'}_(ツ)_/“@DavidSucharda它安全吗?!谷歌使用它吗?这个
com.android.tools.build:gradle:2.2.3
在谷歌maven repo
google()中
@tibuurcio实际上不是,反正它是一个非常旧的版本。@damii这是一个解决办法,因为谷歌自己的回购协议由于某种原因没有所需的依赖项。我建议在谷歌重新添加后删除它,否则我们将知道他们将它移到了哪里。它现在已经修复,每个人都可以删除临时解决方案:)