Lcom/google/firebase/FirebaseApp 类中没有虚拟方法 zzbqo()Z;或其超类('com.google.firebase.FirebaseApp' 的声明

Posted

技术标签:

【中文标题】Lcom/google/firebase/FirebaseApp 类中没有虚拟方法 zzbqo()Z;或其超类(\'com.google.firebase.FirebaseApp\' 的声明【英文标题】:No virtual method zzbqo()Z in class Lcom/google/firebase/FirebaseApp; or its super classes (declaration of 'com.google.firebase.FirebaseApp'Lcom/google/firebase/FirebaseApp 类中没有虚拟方法 zzbqo()Z;或其超类('com.google.firebase.FirebaseApp' 的声明 【发布时间】:2018-12-22 11:43:38 【问题描述】:

在我的 android 应用程序中,编译应用程序时出错。我在最新的 android studio 中工作并使用 Firebase UI Auth 和 Firebase Database 所有版本在 App level Grade 文件中都是相同的,那么为什么我会收到这个错误

错误:

E/AndroidRuntime: FATAL EXCEPTION: main
              Process: com.dotndash.abjb.vishwakarmajanganna, PID: 7689
              java.lang.NoSuchMethodError: No virtual method zzbqo()Z in class Lcom/google/firebase/FirebaseApp; or its super classes (declaration of 'com.google.firebase.FirebaseApp' appears in /data/app/com.dotndash.abjb.vishwakarmajanganna-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.dotndash.abjb.vishwakarmajanganna.RegisterActivity.onCreate(RegisterActivity.java:38)
                  at android.app.Activity.performCreate(Activity.java:6956)
                  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2927)
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3045)
                  at android.app.ActivityThread.-wrap14(ActivityThread.java)
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1642)
                  at android.os.Handler.dispatchMessage(Handler.java:102)
                  at android.os.Looper.loop(Looper.java:154)
                  at android.app.ActivityThread.main(ActivityThread.java:6776)
                  at java.lang.reflect.Method.invoke(Native Method)
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1518)
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)

Build.gradle

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.2'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-auth: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.firebaseui:firebase-ui-auth:4.0.0'

【问题讨论】:

【参考方案1】:

升级以下内容:

implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.firebaseui:firebase-ui-auth:4.0.0'

到这里:

implementation 'com.google.firebase:firebase-auth:16.0.2'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.firebaseui:firebase-ui-auth:4.1.0'

还要补充:

implementation 'com.google.firebase:firebase-core:16.0.1'

在*** gradle 文件中升级 google-service 插件:

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

https://firebase.google.com/support/release-notes/android

firebaseui 需要与 firebase 版本兼容,查看以下链接了解更多信息:

https://github.com/firebase/FirebaseUI-Android/blob/master/README.md#dependencies

【讨论】:

【参考方案2】:

这些已更新为以下内容:

implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
implementation 'com.google.firebase:firebase-auth:18.1.0'

【讨论】:

以上是关于Lcom/google/firebase/FirebaseApp 类中没有虚拟方法 zzbqo()Z;或其超类('com.google.firebase.FirebaseApp' 的声明的主要内容,如果未能解决你的问题,请参考以下文章