在进行任何更改之前,gradle
看起来像这样:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.android.gms:play-services-auth:10.0.1'
compile 'com.firebaseui:firebase-ui-auth:1.0.1'
}
apply plugin: 'com.google.gms.google-services'
和
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
一切都很好。然后我将所有com/google...
个依赖关系更新为10.2.0
版本,将firebaseui
更新为1.2.0
,因为此处的表格显示https://github.com/firebase/FirebaseUI-Android#compatibility-with-firebase--google-play-services-libraries
然后我在mFirebaseAuth = FirebaseAuth.getInstance()
行遇到了一些错误(抱歉但不记得究竟是什么)所以我将所有版本都更改为10.0.1
和1.0.1
,我仍然获取错误并且我的应用程序在启动时崩溃(此错误与前一个错误不同)。
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mnm135.emil.showsmanager, PID: 3837
java.lang.NoSuchMethodError: No static method zzdz(Ljava/lang/String;)Z in class Lcom/google/android/gms/common/util/zzw; or its super classes (declaration of 'com.google.android.gms.common.util.zzw' appears in /data/app/com.mnm135.emil.showsmanager-1/base.apk)
at com.google.firebase.FirebaseOptions.<init>(Unknown Source)
at com.google.firebase.FirebaseOptions.fromResource(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:1751)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1726)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5811)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5403)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5342)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
我尝试了Invalidate caches / restart,clean并重新运行。甚至重启我的电脑。似乎没什么用。
有什么想法吗?
编辑:
我尝试了aaroncio的解决方案,删除了apply plugin: 'com.google.gms.google-services'
,我得到了不同的错误:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mnm135.emil.showsmanager, PID: 5157
java.lang.NoSuchMethodError: No static method zzzq()Ljava/lang/String; in class Lcom/google/android/gms/common/util/zzu; or its super classes (declaration of 'com.google.android.gms.common.util.zzu' appears in /data/app/com.mnm135.emil.showsmanager-2/base.apk)
at com.google.firebase.FirebaseApp.getInstance(Unknown Source)
at com.google.firebase.auth.FirebaseAuth.getInstance(Unknown Source)
at com.mnm135.emil.showsmanager.base.LoginActivity.onCreate(LoginActivity.java:34)
at android.app.Activity.performCreate(Activity.java:6662)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
评论中提到的行是mFirebaseAuth = FirebaseAuth.getInstance();
答案 0 :(得分:2)
我解决了在build-gradle文件中删除有关firebase-authentication的问题:
compile 'com.google.firebase:firebase-auth:10.2.1'
我也删除了有关身份验证的导入,我只是使用firebase auth进行了一些实验,因此在这种情况下它并不重要,但对其他人来说可能不是理想的解决方案。
答案 1 :(得分:-1)
看起来最新版本的Google服务发生了变化,我遇到了类似的问题并解决了它在gradle中删除以下行:
apply plugin: 'com.google.gms.google-services'