应用在Firebase数据库getinstance上崩溃

在出现此错误之前,我将firebase-auth更新到版本16.0.2,以解决“程序类型已存在:com.google.android.gms.internal”错误。那会相关吗?


崩溃日志:


> java.lang.NoSuchMethodError: No virtual method zzboy()Z in class

> Lcom/google/firebase/FirebaseApp; or its super classes (declaration of

> 'com.google.firebase.FirebaseApp' appears in

> /data/app/com.bignerdranch.android.instagramclone-1/split_lib_dependencies_apk.apk)

>                       at com.google.firebase.database.FirebaseDatabase.getInstance(Unknown Source)

>                       at com.google.firebase.database.FirebaseDatabase.getInstance(Unknown Source)

>                       at com.bignerdranch.android.instagramclone.Utils.FirebaseMethods.<init>(FirebaseMethods.java:57)

>                       at com.bignerdranch.android.instagramclone.Share.NextActivity.onCreate(NextActivity.java:49)

>                       at android.app.Activity.performCreate(Activity.java:6372)

>                       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)

>                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2432)

>                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2539)

>                       at android.app.ActivityThread.access$900(ActivityThread.java:168)


项目gradle:


buildscript {

    repositories {

        jcenter()

        google()

    }

    dependencies {

        classpath 'com.android.tools.build:gradle:3.1.2'


        // NOTE: Do not place your application dependencies here; they belong

        // in the individual module build.gradle files


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

    }

}


allprojects {

    repositories {

        jcenter()

        maven { url "https://jitpack.io" }

        google() // Google's Maven repository

    }

}


task clean(type: Delete) {

    delete rootProject.buildDir

}


慕婉清6462132
浏览 363回答 2
2回答

慕雪6442864

您对firebase-database的依赖确实很老。尝试使用最新版本:implementation&nbsp;'com.google.firebase:firebase-database:16.0.1'此页面上列出了每个依赖项的最新版本。

斯蒂芬大帝

我升级到4.2.0并成功了classpath 'com.google.gms:google-services:4.2.0'
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java