justinrixx justinrixx - 4 months ago 121
Android Question

FirebaseUI auth is crashing on android

I'm trying to get authentication working with the new FirebaseUI. I'm getting the following error in 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)


I'm kicking off an auth request in onCreate:

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();
}


and accepting the result in 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();
}
}
}


I think I've got it set up correctly. I downloaded my google-services.json and placed in in my
app/
directory.
Here's my project
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
}


and my app gradle file

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'


The crash is happening right when the app opens, and I assume it's just some little thing with one of my configurations.

Thanks

Answer

I had this same issue. It seemingly happened from one build to another which was weird.

Since the error message complained about missing gms stuff, what fixed it for me was adding following to my dependencies:

compile 'com.google.android.gms:play-services-auth:9.2.0'

I believe this should already be a dependency of the Firebase Auth library, so I'm guessing it is some sort of bug.

Comments