Android Studio:添加Firebase存储后,任务“:app:processDebugGoogleServices”执行失败

时间:2017-06-24 03:43:01

标签: android android-studio firebase gradle

我刚刚将代码添加到Android Studio项目中以使用Firebase存储并出现此错误:

  

任务执行失败':app:processDebugGoogleServices'。   请通过更新版本来修复版本冲突   google-services插件(有关最新版本的信息,请访问:   https://bintray.com/android/android-tools/com.google.gms.google-services/)或   将com.google.android.gms的版本更新为10.0.1。

这是我的app / build.gradle文件:

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'

这是我的项目级build.gradle文件:

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与清单中的相同。我需要改变什么?

1 个答案:

答案 0 :(得分:0)

只需更新您的依赖项

 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'