Java 任务';的执行失败:app:processDebugGoogleServices';Firebase&;安卓工作室

Java 任务';的执行失败:app:processDebugGoogleServices';Firebase&;安卓工作室,java,android,firebase,firebase-realtime-database,Java,Android,Firebase,Firebase Realtime Database,我想将Firebase数据库添加到我的Android应用程序中,但出现了错误 失败:生成失败,出现异常 出了什么问题: 任务“:app:processDebugGoogleServices”的执行失败 请通过更新google services插件的版本(有关最新版本的信息,请访问)或将com.google.android.gms的版本更新为11.8.0来修复版本冲突 尝试: 使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获得更多日志输出。使用-

我想将Firebase数据库添加到我的Android应用程序中,但出现了错误

失败:生成失败,出现异常

  • 出了什么问题: 任务“:app:processDebugGoogleServices”的执行失败

    请通过更新google services插件的版本(有关最新版本的信息,请访问)或将com.google.android.gms的版本更新为11.8.0来修复版本冲突

  • 尝试: 使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获得更多日志输出。使用--scan运行以获得完整的洞察力

build.gradle应用程序

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.lukasz.ogloszenia"
        minSdkVersion 14
        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'
        }
    }
    compileOptions {
        targetCompatibility 1.8
        sourceCompatibility 1.8
        }
    }
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'com.android.support:appcompat-v7:27.1.1'
        implementation 'com.android.support.constraint:constraint-layout:1.1.0'
        implementation 'com.android.support:support-v4:27.1.1'
        implementation 'com.google.firebase:firebase-database:11.8.0'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-                    core:3.0.2'

        implementation 'com.google.android.gms:play-services-maps:12.0.1'
        compile 'com.google.gms:google-services:4.0.1'

    }
    apply plugin: 'com.google.gms.google-services'
有人能帮我吗?

更改此选项:

implementation 'com.google.firebase:firebase-database:11.8.0'
为此:

implementation 'com.google.firebase:firebase-database:12.0.1'
所有google play服务和firebase依赖项都需要具有相同的版本号

此更改从版本号15开始:

每个与com.google.android.gms:play services-*和com.google.firebase:firebase-*匹配的Maven依赖项不再需要具有相同的版本号,以便在构建时和运行时正常工作

更改此选项:

implementation 'com.google.firebase:firebase-database:11.8.0'
为此:

implementation 'com.google.firebase:firebase-database:12.0.1'
所有google play服务和firebase依赖项都需要具有相同的版本号

此更改从版本号15开始:

每个与com.google.android.gms:play services-*和com.google.firebase:firebase-*匹配的Maven依赖项不再需要具有相同的版本号,以便在构建时和运行时正常工作