Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NoClassDefFoundErrors logspam for missing providers #1201

Conversation

wojtek-kalicinski
Copy link

This moves the optional SDK callback implementations to inner classes, to prevent NoClassDefFoundErrors in logcat when ART verifies the outer classes.

Fixes issue #1200

@samtstern
Copy link
Contributor

Thanks @wojtek-kalicinski this makes a lot of sense. However we've got a PR going that totally removes the Provider class anyway, to replace it with something better. So I probably won't merge this as-is, but we'll make sure that the new classes don't directly inherit from any Facebook/Twitter classes.

@SUPERCILEX can you work this into your PR?

@wojtek-kalicinski
Copy link
Author

Sounds good, thanks Sam!

@SUPERCILEX
Copy link
Collaborator

Yeah, I can totally do that. However, I'd like to see some logcat errors: is it crashing? What do you mean by "spammed with NCDEs?" I have trouble seeing how we'll get those errors if we never load the provider classes...

@wojtek-kalicinski
Copy link
Author

It's not crashing, as the classes are not loaded. But before that, ART tries to verify them eagerly and just logs all these ncdf errors and stack traces (I'm not at my computer now so can't paste them).
It's just super annoying for development seeing this every time, not sure if it has actual performance impact, but it's better to avoid verification errors in any case.

@SUPERCILEX
Copy link
Collaborator

Oh gotya, here's the stack trace:


03-22 23:35:27.252 32592-32592/com.firebase.uidemo I/zygote: Rejecting re-init on previously-failed class java.lang.Class<com.firebase.ui.auth.data.remote.FacebookSignInHandler>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/facebook/FacebookCallback;
03-22 23:35:27.253 32592-32592/com.firebase.uidemo I/zygote:     at android.content.Intent com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity.createIntent(android.content.Context, com.firebase.ui.auth.data.model.FlowParameters) (AuthMethodPickerActivity.java:66)
03-22 23:35:27.253 32592-32592/com.firebase.uidemo I/zygote:     at void com.firebase.ui.auth.util.signincontainer.SignInDelegate.startAuthMethodChoice() (SignInDelegate.java:290)
03-22 23:35:27.253 32592-32592/com.firebase.uidemo I/zygote:     at void com.firebase.ui.auth.util.signincontainer.SignInDelegate.onComplete(com.google.android.gms.tasks.Task) (SignInDelegate.java:174)
03-22 23:35:27.254 32592-32592/com.firebase.uidemo I/zygote:     at void com.google.android.gms.tasks.zzf.run() ((null):-1)
03-22 23:35:27.254 32592-32592/com.firebase.uidemo I/zygote:     at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:789)
03-22 23:35:27.254 32592-32592/com.firebase.uidemo I/zygote:     at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:98)
03-22 23:35:27.254 32592-32592/com.firebase.uidemo I/zygote:     at void android.os.Looper.loop() (Looper.java:164)
03-22 23:35:27.254 32592-32592/com.firebase.uidemo I/zygote:     at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6541)
03-22 23:35:27.255 32592-32592/com.firebase.uidemo I/zygote:     at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
03-22 23:35:27.255 32592-32592/com.firebase.uidemo I/zygote:     at void com.android.internal.os.Zygote$MethodAndArgsCaller.run() (Zygote.java:240)
03-22 23:35:27.255 32592-32592/com.firebase.uidemo I/zygote:     at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:767)
03-22 23:35:27.255 32592-32592/com.firebase.uidemo I/zygote: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.FacebookCallback" on path: DexPathList[[zip file "/data/app/com.firebase.uidemo-g1xEpphJo4K4RUKqccR2XA==/base.apk"],nativeLibraryDirectories=[/data/app/com.firebase.uidemo-g1xEpphJo4K4RUKqccR2XA==/lib/x86, /system/lib, /vendor/lib]]
03-22 23:35:27.255 32592-32592/com.firebase.uidemo I/zygote:     at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:93)
03-22 23:35:27.255 32592-32592/com.firebase.uidemo I/zygote:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)
03-22 23:35:27.255 32592-32592/com.firebase.uidemo I/zygote:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
03-22 23:35:27.256 32592-32592/com.firebase.uidemo I/zygote:     at android.content.Intent com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity.createIntent(android.content.Context, com.firebase.ui.auth.data.model.FlowParameters) (AuthMethodPickerActivity.java:66)
03-22 23:35:27.256 32592-32592/com.firebase.uidemo I/zygote:     at void com.firebase.ui.auth.util.signincontainer.SignInDelegate.startAuthMethodChoice() (SignInDelegate.java:290)
03-22 23:35:27.256 32592-32592/com.firebase.uidemo I/zygote:     at void com.firebase.ui.auth.util.signincontainer.SignInDelegate.onComplete(com.google.android.gms.tasks.Task) (SignInDelegate.java:174)
03-22 23:35:27.256 32592-32592/com.firebase.uidemo I/zygote:     at void com.google.android.gms.tasks.zzf.run() ((null):-1)
03-22 23:35:27.256 32592-32592/com.firebase.uidemo I/zygote:     at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:789)
03-22 23:35:27.256 32592-32592/com.firebase.uidemo I/zygote:     at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:98)
03-22 23:35:27.256 32592-32592/com.firebase.uidemo I/zygote:     at void android.os.Looper.loop() (Looper.java:164)
03-22 23:35:27.256 32592-32592/com.firebase.uidemo I/zygote:     at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6541)
03-22 23:35:27.256 32592-32592/com.firebase.uidemo I/zygote:     at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
03-22 23:35:27.256 32592-32592/com.firebase.uidemo I/zygote:     at void com.android.internal.os.Zygote$MethodAndArgsCaller.run() (Zygote.java:240)
03-22 23:35:27.256 32592-32592/com.firebase.uidemo I/zygote:     at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:767)

@SUPERCILEX
Copy link
Collaborator

SUPERCILEX commented Mar 22, 2018

Ohhhh, so you guys are pre-loading the classes to improve performance? ClassLoader#loadClass(String), right? Anyway, fixed in https://github.com/SUPERCILEX/FirebaseUI-Android/commit/d111daadacf283d6818501a0c6b0dd571328e910.

@samtstern
Copy link
Contributor

#1189 just went in so closing this, look out for 3.3.0 and thanks for flagging!

@samtstern samtstern closed this Mar 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants