无法获取 google-services-4.3.3 - Firebase 实施

Posted

技术标签:

【中文标题】无法获取 google-services-4.3.3 - Firebase 实施【英文标题】:Could not get google-services-4.3.3 - Firebase implementation 【发布时间】:2020-03-18 13:56:20 【问题描述】:

我是 android Studio 的新手,我正在尝试在我的项目中实现 Firebase,但是在我尝试实现 "classpath 'com.google.gms:google-services:4.3. 3'".

当我尝试同步 Gradle 时,我收到此错误:Could not GET google-services-4.3.2, 403 Forbidden

这是我的项目/build.gradle:

    buildscript 
    ext.kotlin_version = '1.2.30'
    repositories 
        google()
        jcenter()
        maven  url "https://dl.bintray.com/android/android-tools" 
    
    dependencies 
        classpath 'com.android.tools.build:gradle:3.1.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    


allprojects 
    repositories 
        google()
        jcenter()
    


task clean(type: Delete) 
    delete rootProject.buildDir

我的应用程序/build.gradle:

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android 
    compileSdkVersion 27
    defaultConfig 
        applicationId "com.example.xxxxxx.tabataworkout"
        minSdkVersion 16
        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"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.8'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    def room_version = "1.1.1"
    implementation "android.arch.persistence.room:runtime:$room_version"
    annotationProcessor "android.arch.persistence.room:compiler:$room_version"
    testImplementation "android.arch.persistence.room:testing:$room_version"
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.google.firebase:firebase-auth:19.1.0'
    implementation 'com.android.support:design:27.1.1'


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

【问题讨论】:

检查您的网络连接 检查您的网络连接是否不稳定 也可能值得将项目/build.gradle 中的 gradle 版本从 3.1.1 升级到类似 3.5.2 【参考方案1】:

在您的项目 build.gradle 文件中:

 buildscript 
    repositories 
        google()
        mavenCentral()
        jcenter()
    
    dependencies 
        classpath 'com.android.tools.build:gradle:3.3.2'
        classpath 'com.google.gms:google-services:4.2.0' 


    

allprojects 
    repositories 
        maven  url "https://maven.google.com" 

        google()
        mavenCentral()
        jcenter()


    


task clean(type: Delete) 
    delete rootProject.buildDir

在您的应用 build.gradle 文件中:

//Firebase Dependencies
implementation "com.google.firebase:firebase-messaging:17.0.0"
implementation "com.google.firebase:firebase-core:16.0.0"
implementation "com.google.firebase:firebase-config:16.0.0"
implementation 'com.google.firebase:firebase-perf:16.0.0'

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

Databinding 也设置为 true:

dataBinding 
    enabled = true

【讨论】:

以上是关于无法获取 google-services-4.3.3 - Firebase 实施的主要内容,如果未能解决你的问题,请参考以下文章

为什么新的Firebase Crashlytics(没有Fabric)在Android中不起作用?

当通知点击后应用程序未在堆栈上打开时在android中不起作用

PHP无法获取POST的数据,可以获取GET数据

Ubuntu更新源 后无法获取IP

错误:您所请求的网址(URL)无法获取 怎么搞的?

无法使用 StorageClass 配置卷 - 无法获取存储帐户的存储密钥