找不到com.google.gms:google-services:4.0.1 [英] Could not find com.google.gms:google-services:4.0.1

查看:139
本文介绍了找不到com.google.gms:google-services:4.0.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我在android中启动了一个新项目,并按照google docs中的说明导入了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
}

应用程序级别Gradle是:

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'

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

解决方案

我遇到了同样的问题,似乎Google repo缺少此依赖项.我检查了存储库,并且gms文件夹不包含任何已发布的版本./p>

作为快速解决方案,我添加了另一个存储库:

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

编辑:由于这只是一个临时解决方案,我认为这是一种解决方法,因此我可以继续进行开发.稍后,当Google存储库将包含该依赖关系或我们知道他们将其移到何处时,我将删除此依赖关系.

Hi i started a new project in android and imported firebase as told in google docs. Everything was perfect in Android studio 3.0.1. Now i update my Android studio to 3.2.1. Now the same code is rebuild and got error that

Could not find com.google.gms:google-services:4.0.1

Log was:

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 :

My Project Level Gradle is:

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
}

App level Gradle is:

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'

What is the issue here! Please help me out!

解决方案

I have the same problem, it seems like Google repo is missing this dependency. I checked the repository and gms folder does not contain any published versions.

So as a quick fix I added another repository, that has it:

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

EDIT: Since this is only a temporary solution and I consider it as a workaround so I am able to continue developing. I will remove this depencency later when Google repository will contain the depency or we know where they moved it.

这篇关于找不到com.google.gms:google-services:4.0.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆