请评论为什么它被downvoted,我应该添加更多 这是logcat输出
06-02 15:21:04.520 7986-7986/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.mayurn.engineeringhelper, PID: 7986
java.lang.NoSuchMethodError: No static method zzcx(Landroid/content/Context;)Lcom/google/android/gms/internal/zzbth; in class Lcom/google/android/gms/internal/zzbth; or its super classes (declaration of 'com.google.android.gms.internal.zzbth' appears in /data/app/com.example.mayurn.engineeringhelper-2/base.apk:classes12.dex)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5187)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4782)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4722)
at android.app.ActivityThread.access$1600(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1408)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5451)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
在我的Build.gradle(模块:应用程序)中,我有
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha8'
compile 'com.android.support:recyclerview-v7:25.3.0'
compile 'com.android.support:cardview-v7:25.3.0'
compile 'com.android.support:design:25.3.0'
compile 'com.google.firebase:firebase-storage:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.firebase:firebase-client-android:2.4.0'
compile 'com.firebaseui:firebase-ui-storage:1.2.0'
compile 'com.firebaseui:firebase-ui-database:1.2.0'
compile 'com.android.support:multidex:1.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
在build.gradle(Project)中我有这个
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我已经看到了这些答案
他们建议使用相同版本的firebase服务。
您可以看到我已经这样做了,ui-database
和ui-storage
的唯一版本不同。
同样简短说明:-MultiDex已启用且minify已禁用。
答案 0 :(得分:1)
您的依赖项中的问题是您的 firebaseui 库与 firebase 库不兼容。
检查Compatibility with Firebase / Google Play Services Libraries。
您需要 1.2.0 版本的 firebaseui ,因此您必须将 firebase 库更新为 10.2.0 +
答案 1 :(得分:0)
在build.gradle中,您需要添加所有依赖项 -
dependencies {
// FirebaseUI Database only
compile 'com.firebaseui:firebase-ui-database:1.2.0'
// FirebaseUI Auth onl
compile 'com.firebaseui:firebase-ui-auth:1.2.0'
// FirebaseUI Storage only
compile 'com.firebaseui:firebase-ui-storage:1.2.0'
// Single target that includes all FirebaseUI libraries above
compile 'com.firebaseui:firebase-ui:1.2.0'
}
如果这不能解决您的错误,那么您可能还想添加这些文件
compile "com.android.support:design:23.2.1"
compile "com.android.support:customtabs:23.2.1"
compile "com.android.support:cardview-v7:23.2.1"
我希望在做完这一切之后,你的问题应该早已过去。 顺便提一下,有关这方面的更多信息,你可以查看Firebase的Git仓库 - https://github.com/firebase/FirebaseUI-Android#installation实际上这里有所有细节。