如何解决firebase构建失败错误?

时间:2019-02-16 09:56:08

标签: java android firebase gradle

我尝试用firebase制作chatapp,但是当我尝试在模拟器上运行该应用程序时,出现以下错误:错误:键入com.google.firebase.FirebaseApp $ zza作为com.google.android.gms.internal.zzbkv$3的接口。 “

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

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.firebasechat"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0-alpha02'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.firebase:firebase-core:16.0.7'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.2-alpha01'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.2-alpha01'

    implementation 'com.google.android.material:material:1.1.0-alpha03'
    implementation 'com.firebaseui:firebase-ui:1.1.1'
    implementation 'com.google.firebase:firebase-auth:16.1.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'

    implementation 'com.jakewharton:butterknife:10.1.0'
    annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
}

1 个答案:

答案 0 :(得分:0)

应用插件:“ com.google.gms.google-services”

classpath'com.google.gms:google-services:4.0.1'

检查gradle模块中的声明插件。并定义类路径以投影gradle