我尝试使用新的FirebaseUI进行身份验证。我在LogCat
中收到以下错误07-01 22:33:17.170 715-789/com.gmail.rixx.justin.cashcaddy I/OpenGLRenderer: Initialized EGL, version 1.4
07-01 22:33:17.234 715-715/com.gmail.rixx.justin.cashcaddy I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.auth.api.credentials.internal.zzf>
07-01 22:33:17.235 715-715/com.gmail.rixx.justin.cashcaddy I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.auth.api.credentials.internal.zzf>
07-01 22:33:17.242 715-715/com.gmail.rixx.justin.cashcaddy I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.auth.api.credentials.internal.zze$3>
07-01 22:33:17.242 715-715/com.gmail.rixx.justin.cashcaddy I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.auth.api.credentials.internal.zze$3>
07-01 22:33:17.243 715-715/com.gmail.rixx.justin.cashcaddy I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.auth.api.credentials.internal.zzf>
07-01 22:33:17.243 715-715/com.gmail.rixx.justin.cashcaddy I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.auth.api.credentials.internal.zze$4>
07-01 22:33:17.243 715-715/com.gmail.rixx.justin.cashcaddy I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.auth.api.credentials.internal.zze$4>
07-01 22:33:17.244 715-715/com.gmail.rixx.justin.cashcaddy I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.auth.api.credentials.internal.zzf>
07-01 22:33:17.244 715-715/com.gmail.rixx.justin.cashcaddy I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.auth.api.credentials.internal.zze$1>
07-01 22:33:17.245 715-715/com.gmail.rixx.justin.cashcaddy I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.auth.api.credentials.internal.zze$1>
07-01 22:33:17.245 715-715/com.gmail.rixx.justin.cashcaddy I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.auth.api.credentials.internal.zzf>
07-01 22:33:17.246 715-715/com.gmail.rixx.justin.cashcaddy I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.auth.api.credentials.internal.zze$2>
07-01 22:33:17.246 715-715/com.gmail.rixx.justin.cashcaddy I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.auth.api.credentials.internal.zze$2>
07-01 22:33:17.247 715-715/com.gmail.rixx.justin.cashcaddy I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.auth.api.signin.internal.zzc$zza>
07-01 22:33:17.247 715-715/com.gmail.rixx.justin.cashcaddy I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.auth.api.signin.internal.zzc$zza>
07-01 22:33:17.248 715-715/com.gmail.rixx.justin.cashcaddy I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.auth.api.signin.internal.zzc$1>
07-01 22:33:17.248 715-715/com.gmail.rixx.justin.cashcaddy I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.auth.api.signin.internal.zzc$1>
07-01 22:33:17.251 715-715/com.gmail.rixx.justin.cashcaddy D/AndroidRuntime: Shutting down VM
07-01 22:33:17.259 715-715/com.gmail.rixx.justin.cashcaddy E/UncaughtException: java.lang.NoSuchMethodError: No virtual method zztw()Ljava/util/Set; in class Lcom/google/android/gms/common/internal/zzg; or its super classes (declaration of 'com.google.android.gms.common.internal.zzg' appears in /data/app/com.gmail.rixx.justin.cashcaddy-2/base.apk)
at com.google.android.gms.auth.api.signin.internal.zzd.<init>(Unknown Source)
at com.google.android.gms.auth.api.Auth$4.zza(Unknown Source)
at com.google.android.gms.auth.api.Auth$4.zza(Unknown Source)
at com.google.android.gms.common.api.GoogleApiClient$Builder.zza(Unknown Source)
at com.google.android.gms.common.api.GoogleApiClient$Builder.zzaof(Unknown Source)
at com.google.android.gms.common.api.GoogleApiClient$Builder.build(Unknown Source)
at com.firebase.ui.auth.util.CredentialsAPI.initGoogleApiClient(CredentialsAPI.java:148)
at com.firebase.ui.auth.util.CredentialsAPI.<init>(CredentialsAPI.java:64)
at com.firebase.ui.auth.ui.ChooseAccountActivity.onCreate(ChooseAccountActivity.java:64)
at android.app.Activity.performCreate(Activity.java:6251)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5422)
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)
07-01 22:33:17.261 715-773/com.gmail.rixx.justin.cashcaddy I/FA: Tag Manager is not found and thus will not be used
07-01 22:33:17.481 715-715/com.gmail.rixx.justin.cashcaddy D/FirebaseCrashApiImpl: throwable java.lang.NoSuchMethodError: No virtual method zztw()Ljava/util/Set; in class Lcom/google/android/gms/common/internal/zzg; or its super classes (declaration of 'com.google.android.gms.common.internal.zzg' appears in /data/app/com.gmail.rixx.justin.cashcaddy-2/base.apk)
07-01 22:33:17.517 715-715/com.gmail.rixx.justin.cashcaddy E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.gmail.rixx.justin.cashcaddy, PID: 715
java.lang.NoSuchMethodError: No virtual method zztw()Ljava/util/Set; in class Lcom/google/android/gms/common/internal/zzg; or its super classes (declaration of 'com.google.android.gms.common.internal.zzg' appears in /data/app/com.gmail.rixx.justin.cashcaddy-2/base.apk)
at com.google.android.gms.auth.api.signin.internal.zzd.<init>(Unknown Source)
at com.google.android.gms.auth.api.Auth$4.zza(Unknown Source)
at com.google.android.gms.auth.api.Auth$4.zza(Unknown Source)
at com.google.android.gms.common.api.GoogleApiClient$Builder.zza(Unknown Source)
at com.google.android.gms.common.api.GoogleApiClient$Builder.zzaof(Unknown Source)
at com.google.android.gms.common.api.GoogleApiClient$Builder.build(Unknown Source)
at com.firebase.ui.auth.util.CredentialsAPI.initGoogleApiClient(CredentialsAPI.java:148)
at com.firebase.ui.auth.util.CredentialsAPI.<init>(CredentialsAPI.java:64)
at com.firebase.ui.auth.ui.ChooseAccountActivity.onCreate(ChooseAccountActivity.java:64)
at android.app.Activity.performCreate(Activity.java:6251)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5422)
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)
我在onCreate中启动了一个auth请求:
FirebaseAuth auth = FirebaseAuth.getInstance();
if (auth.getCurrentUser() != null) {
// already signed in
Toast.makeText(this, "Signed in!", Toast.LENGTH_LONG).show();
} else {
startActivityForResult(
// Get an instance of AuthUI based on the default app
AuthUI.getInstance().createSignInIntentBuilder().build(),
RC_SIGN_IN);
Toast.makeText(this, "Not signed in", Toast.LENGTH_LONG).show();
}
并接受onActivityResult
中的结果protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RC_SIGN_IN) {
if (resultCode == RESULT_OK) {
// user is signed in
Toast.makeText(this, "Signed in!", Toast.LENGTH_LONG).show();
} else {
// user is not signed in. Maybe just wait for the user to press
// "sign in" again, or show a message
Toast.makeText(this, "Not signed in!", Toast.LENGTH_LONG).show();
}
}
}
我想我已经正确设置了它。我下载了google-services.json并将其放入我的app/
目录中。
这是我的项目build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
和我的应用程序gradle文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.gmail.rixx.justin.cashcaddy"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.google.firebase:firebase-core:9.2.0'
compile 'com.google.firebase:firebase-database:9.2.0'
compile 'com.google.firebase:firebase-auth:9.2.0'
compile 'com.google.firebase:firebase-crash:9.2.0'
compile 'com.firebaseui:firebase-ui:0.4.1'
}
apply plugin: 'com.google.gms.google-services'
当应用程序打开时,崩溃正在发生,我认为它只是我的一个配置的一些小东西。
由于
答案 0 :(得分:5)
我有同样的问题。它似乎从一个构建发生到另一个构建,这很奇怪。
由于错误消息抱怨缺少gms的东西,为我修复它的是在我的依赖项中添加以下内容:
compile 'com.google.android.gms:play-services-auth:9.2.0'
我认为这应该已经成为Firebase Auth库的依赖项,因此我猜测它是某种bug。
答案 1 :(得分:1)
Android版Firebase UI版本0.4.2
刚刚发布,它包含解决此问题的必要基础更改。