当前位置: 首页 > 知识库问答 >
问题:

Android Studio:添加Firebase存储后执行任务“:app:ProcessDebugGoogleServices”错误失败

易骁
2023-03-14

我刚刚在我的Android Studio项目中添加了使用Firebase存储的代码,得到了这个错误:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.0"
    defaultConfig {
        applicationId "myappIDhere"
        minSdkVersion 15
        targetSdkVersion 26
        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(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile files('libs/commons-codec-1.10/commons-codec-1.10.jar')
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2' 
    compile 'com.android.support:design:26.+'
    compile 'com.google.gms:google-services:3.1.0'
    compile 'com.google.firebase:firebase-auth:10.0.1'
    compile 'com.google.firebase:firebase-database:10.0.1'
    compile 'com.google.firebase:firebase-storage:11.0.1'
    testCompile 'junit:junit:4.12'
}

apply plugin: 'com.google.gms.google-services'
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath 'com.google.gms:google-services:3.1.0'
    }
}
allprojects {
    repositories {
        jcenter()
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}

google-services.json文件中的package_name与清单中的package_name相同。我需要改变什么?

共有1个答案

陶修洁
2023-03-14

只需更新您的依赖项

 compile 'com.google.firebase:firebase-auth:11.0.1'
 compile 'com.google.firebase:firebase-database:11.0.1'
 compile 'com.google.firebase:firebase-storage:11.0.1'
 类似资料: