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

java.lang.ClassNotFoundException: com.firebase.ui.auth.data.model.FlowParameters #1416

Closed
dimipaun opened this issue Aug 24, 2018 · 28 comments
Closed

Comments

@dimipaun
Copy link
Contributor

Step 1:

When trying to get the Auth UI going:

        Intent intent = AuthUI.getInstance()
                    .createSignInIntentBuilder()
                    .setTheme(R.style.SplashTheme)
                    .setAvailableProviders(idpConfigs)
                    .setTosAndPrivacyPolicyUrls(getString(R.string.terms_url), getString(R.string.privacy_url))
                    .setIsSmartLockEnabled(!BuildConfig.DEBUG)
                    .build();
        startActivityForResult(intent, RC_FIREBASE_UI_SIGNIN);

I see the following behaviour:

  • if idpConfigs contains exactly one item, it correctly proceeds to the one login method
  • if idpConfigs contains more than one item, the AuthMethodPickerActivity is displayed WITHOUT any of the login buttons (but it correctly shows the ToS/PP at the bottom)

Looking through the logs, I see this error:

08-23 21:01:07.343 1358-2025/? E/Parcel: Class not found when unmarshalling: com.firebase.ui.auth.data.model.FlowParameters
    java.lang.ClassNotFoundException: com.firebase.ui.auth.data.model.FlowParameters
        at java.lang.Class.classForName(Native Method)
        at java.lang.Class.forName(Class.java:453)
        at android.os.Parcel.readParcelableCreator(Parcel.java:2835)
        at android.os.Parcel.readParcelable(Parcel.java:2789)
        at android.os.Parcel.readValue(Parcel.java:2692)
        at android.os.Parcel.readArrayMapInternal(Parcel.java:3059)
        at android.os.BaseBundle.unparcel(BaseBundle.java:257)
        at android.os.BaseBundle.getString(BaseBundle.java:1086)
        at android.content.Intent.getStringExtra(Intent.java:7706)
        at com.android.server.am.ActivityStarter.startActivity(ActivityStarter.java:458)
        at com.android.server.am.ActivityStarter.startActivityLocked(ActivityStarter.java:409)
        at com.android.server.am.ActivityStarter.startActivityMayWait(ActivityStarter.java:1270)
        at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:6053)
        at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:5906)
        at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:121)
        at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3887)
        at android.os.Binder.execTransact(Binder.java:682)
     Caused by: java.lang.ClassNotFoundException: com.firebase.ui.auth.data.model.FlowParameters
        at java.lang.Class.classForName(Native Method)
        at java.lang.BootClassLoader.findClass(ClassLoader.java:1355)
        at java.lang.BootClassLoader.loadClass(ClassLoader.java:1415)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at java.lang.Class.classForName(Native Method) 
        at java.lang.Class.forName(Class.java:453) 
        at android.os.Parcel.readParcelableCreator(Parcel.java:2835) 
        at android.os.Parcel.readParcelable(Parcel.java:2789) 
        at android.os.Parcel.readValue(Parcel.java:2692) 
        at android.os.Parcel.readArrayMapInternal(Parcel.java:3059) 
        at android.os.BaseBundle.unparcel(BaseBundle.java:257) 
        at android.os.BaseBundle.getString(BaseBundle.java:1086) 
        at android.content.Intent.getStringExtra(Intent.java:7706) 
        at com.android.server.am.ActivityStarter.startActivity(ActivityStarter.java:458) 
        at com.android.server.am.ActivityStarter.startActivityLocked(ActivityStarter.java:409) 
        at com.android.server.am.ActivityStarter.startActivityMayWait(ActivityStarter.java:1270) 
        at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:6053) 
        at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:5906) 
        at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:121) 
        at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3887) 
        at android.os.Binder.execTransact(Binder.java:682) 
     Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
08-23 21:01:07.343 1358-2025/? W/Bundle: Failed to parse Bundle, but defusing quietly
    android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.firebase.ui.auth.data.model.FlowParameters
        at android.os.Parcel.readParcelableCreator(Parcel.java:2863)
        at android.os.Parcel.readParcelable(Parcel.java:2789)
        at android.os.Parcel.readValue(Parcel.java:2692)
        at android.os.Parcel.readArrayMapInternal(Parcel.java:3059)
        at android.os.BaseBundle.unparcel(BaseBundle.java:257)
        at android.os.BaseBundle.getString(BaseBundle.java:1086)
        at android.content.Intent.getStringExtra(Intent.java:7706)
        at com.android.server.am.ActivityStarter.startActivity(ActivityStarter.java:458)
        at com.android.server.am.ActivityStarter.startActivityLocked(ActivityStarter.java:409)
        at com.android.server.am.ActivityStarter.startActivityMayWait(ActivityStarter.java:1270)
        at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:6053)
        at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:5906)
        at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:121)
        at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3887)
        at android.os.Binder.execTransact(Binder.java:682)

Which would explain the issue. Here's the relevant snippet of my build.gradle:

    // Play Services
    implementation "com.google.android.gms:play-services-auth:15.0.1"
    implementation "com.google.android.gms:play-services-base:15.0.1"
    implementation "com.google.android.gms:play-services-appinvite:15.0.1"
    implementation "com.google.android.gms:play-services-gcm:15.0.1"
    implementation "com.google.android.gms:play-services-location:15.0.1"
    implementation "com.google.android.gms:play-services-places:15.0.1"
    implementation "com.google.android.gms:play-services-ads:15.0.1"

    // Firebase
    implementation "com.google.firebase:firebase-core:16.0.0"
    implementation "com.google.firebase:firebase-auth:16.0.1"
    implementation "com.google.firebase:firebase-database:16.0.1"
    implementation "com.google.firebase:firebase-storage:16.0.1"
    implementation "com.google.firebase:firebase-crash:16.0.1"
    implementation "com.google.firebase:firebase-messaging:17.3.0"
    implementation "com.google.firebase:firebase-config:16.0.0"
    implementation "com.google.firebase:firebase-invites:16.0.1"
    implementation "com.google.firebase:firebase-perf:16.1.0"
    implementation 'com.firebaseui:firebase-ui:4.1.0'

This used to work, but I guess it broke with a recent update of FirebaseUI.

Step 2: Describe your environment

  • Android device: S9+
  • Android OS version: 8.0.0
  • Google Play Services version: 12.8.74
  • Firebase/Play Services SDK version: 15.0.1
  • FirebaseUI version: 4.1.0
@dimipaun
Copy link
Contributor Author

I just updated to Firebase UI 4.2 and I'm getting the same error.

@samtstern
Copy link
Contributor

@dimipaun are you seeing this in both debug an production builds? Are you using ProGuard or R8 in either?

@dimipaun
Copy link
Contributor Author

Yes, I see them in both. And yes, we use ProGuard in both. I don't know about R8 though, how can I tell? I don't remember doing anything to enable it explicitly.

@samtstern
Copy link
Contributor

Ah ok. Can you do two things for me then?

  1. Show me your ProGuard configuration.
  2. Try running a debug build with ProGuard turned off and see if you can still see this issue.

@dimipaun
Copy link
Contributor Author

dimipaun commented Sep 14, 2018

Of course, here's my ProGuard:

-dontwarn java.nio.file.*
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn com.squareup.okhttp.**
-keepattributes Signature
-keepattributes *Annotation*
-keepattributes InnerClasses
-keepclassmembers class co.edgeapp.android.model.** {
  *;
}
-keep class android.support.v7.app.ActionBarActivity { *; }
-keep class android.support.v7.widget.SearchView { *; }
-keep class **.R$* {
    <fields>;
}
-dontwarn com.bumptech.glide.**
-dontwarn android.arch.lifecycle.**

#For Retrofit
# Platform calls Class.forName on types which do not exist on Android to determine platform.
-dontnote retrofit2.Platform
# Platform used when running on RoboVM on iOS. Will not be used at runtime.
-dontnote retrofit2.Platform$IOS$MainThreadExecutor
# Platform used when running on Java 8 VMs. Will not be used at runtime.
-dontwarn retrofit2.Platform$Java8
# Retain generic type information for use by reflection by converters and adapters.
-keepattributes Signature
# Retain declared checked exceptions for use by a Proxy instance.
-keepattributes Exceptions

# Google Play Services
-keep class com.google.** {*;}

# Retrolambda
-dontwarn java.lang.invoke.**
-dontwarn javax.annotation.**

# Joda
-dontwarn org.joda.convert.**
-keep class org.joda.time.tz.Provider
-keep class org.joda.time.tz.NameProvider

# Mike Penz iconics
-keep class com.mikepenz.iconics.typeface.ITypeface

# Crashlytics
-keep class com.crashlytics.** { *; }
-dontwarn com.crashlytics.**

# Fabbutton
-keepclassmembers class mbanje.kurt.fabbutton.R$anim {
    public static <fields>;
}
-dontwarn mbanje.kurt.fabbutton.**

# Twitter
-dontwarn com.twitter.sdk.android.tweetui.CollectionTimeline
-dontwarn com.twitter.sdk.android.tweetui.CollectionTimeline$CollectionCallback

# Facebook
-keep class com.facebook.applinks.** { *; }
-keepclassmembers class com.facebook.applinks.** { *; }
-keep class com.facebook.FacebookSdk { *; }

# Hotline
-keep class com.freshdesk.hotline.** { *; }
-keep class com.freshdesk.hotline.activity.InterstitialActivity { *; }

# EventBus
-keepattributes *Annotation*
-keepclassmembers class ** {
    @org.greenrobot.eventbus.Subscribe <methods>;
}
-keep enum org.greenrobot.eventbus.ThreadMode { *; }

# Only required if you use AsyncExecutor
-keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {
    <init>(java.lang.Throwable);
}

-keep class okio.** { *; }
-dontwarn okio.**
-keep class com.freshdesk.** { *; }
-dontwarn com.freshdesk.**

# Stripe
-keep class com.stripe.** { *; }

# Do not mangle the model objects, screws up Firebase (de)serialization
-keep class co.edgeapp.android.model.** {*;}

# LinkedIn
-keep class com.linkedin.** { *; }
-keepattributes Signature

# Branch IO 
-dontwarn io.branch.**

# SVG
-keep class com.caverock.androidsvg.** { *; }

# Prettytime
-keep class org.ocpsoft.prettytime.i18n.**

# Picasso
-dontwarn org.conscrypt.**

# Timber
-assumenosideeffects class android.util.Log {
    public static boolean isLoggable(java.lang.String, int);
    public static int v(...);
    public static int i(...);
    public static int w(...);
    public static int d(...);
    public static int e(...);
}

# CollageView
-dontwarn com.lopei.collageview.CollageView

-dontwarn com.googlecode.mp4parser.**

@dimipaun
Copy link
Contributor Author

And I double checked, my bad -- we do NOT use ProGuard in debug builds.

@SUPERCILEX
Copy link
Collaborator

Looks like we need to manually set our class loader (that would make sense since flow params won't be in the boot class loader):

return intent.getParcelableExtra(ExtraConstants.FLOW_PARAMS);

@dimipaun
Copy link
Contributor Author

Thanks @SUPERCILEX! So I guess this has to happen on the Firebase UI side - any thoughts on ETA?
Anything I can do to help?

@SUPERCILEX
Copy link
Collaborator

SUPERCILEX commented Sep 18, 2018

Absolutely! From what I understand, you basically want to add this to the line I linked to above: setExtrasClassLoader(AuthUI.class.getClassLoader()).

Do you feel up to submitting a PR? TBH, there's no way of checking if it actually works until you ship it, so as long as that line doesn't break stuff, SGTM. 👍

@samtstern samtstern added this to the 4.2.1 milestone Sep 18, 2018
dimipaun added a commit to dimipaun/FirebaseUI-Android that referenced this issue Sep 18, 2018
@dimipaun
Copy link
Contributor Author

PR #1451

@dimipaun
Copy link
Contributor Author

Bummer,
I tried using 4.2.1-SNAPSHOT, and I get the same in devel (no ProGuard):

2018-09-20 12:10:06.815 1358-2541/? E/Parcel: Class not found when unmarshalling: com.firebase.ui.auth.data.model.FlowParameters
    java.lang.ClassNotFoundException: com.firebase.ui.auth.data.model.FlowParameters
        at java.lang.Class.classForName(Native Method)
        at java.lang.Class.forName(Class.java:453)
        at android.os.Parcel.readParcelableCreator(Parcel.java:2835)
        at android.os.Parcel.readParcelable(Parcel.java:2789)
        at android.os.Parcel.readValue(Parcel.java:2692)
        at android.os.Parcel.readArrayMapInternal(Parcel.java:3059)
        at android.os.BaseBundle.unparcel(BaseBundle.java:257)
        at android.os.BaseBundle.getString(BaseBundle.java:1086)
        at android.content.Intent.getStringExtra(Intent.java:7706)
        at com.android.server.am.ActivityStarter.startActivity(ActivityStarter.java:458)
        at com.android.server.am.ActivityStarter.startActivityLocked(ActivityStarter.java:409)
        at com.android.server.am.ActivityStarter.startActivityMayWait(ActivityStarter.java:1270)
        at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:6053)
        at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:5906)
        at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:121)
        at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3887)
        at android.os.Binder.execTransact(Binder.java:682)
     Caused by: java.lang.ClassNotFoundException: com.firebase.ui.auth.data.model.FlowParameters
        at java.lang.Class.classForName(Native Method)
        at java.lang.BootClassLoader.findClass(ClassLoader.java:1355)
        at java.lang.BootClassLoader.loadClass(ClassLoader.java:1415)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at java.lang.Class.classForName(Native Method) 
        at java.lang.Class.forName(Class.java:453) 
        at android.os.Parcel.readParcelableCreator(Parcel.java:2835) 
        at android.os.Parcel.readParcelable(Parcel.java:2789) 
        at android.os.Parcel.readValue(Parcel.java:2692) 
        at android.os.Parcel.readArrayMapInternal(Parcel.java:3059) 
        at android.os.BaseBundle.unparcel(BaseBundle.java:257) 
        at android.os.BaseBundle.getString(BaseBundle.java:1086) 
        at android.content.Intent.getStringExtra(Intent.java:7706) 
        at com.android.server.am.ActivityStarter.startActivity(ActivityStarter.java:458) 
        at com.android.server.am.ActivityStarter.startActivityLocked(ActivityStarter.java:409) 
        at com.android.server.am.ActivityStarter.startActivityMayWait(ActivityStarter.java:1270) 
        at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:6053) 
        at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:5906) 
        at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:121) 
        at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3887) 
        at android.os.Binder.execTransact(Binder.java:682) 
     Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
2018-09-20 12:10:06.815 1358-2541/? W/Bundle: Failed to parse Bundle, but defusing quietly
    android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.firebase.ui.auth.data.model.FlowParameters
        at android.os.Parcel.readParcelableCreator(Parcel.java:2863)
        at android.os.Parcel.readParcelable(Parcel.java:2789)
        at android.os.Parcel.readValue(Parcel.java:2692)
        at android.os.Parcel.readArrayMapInternal(Parcel.java:3059)
        at android.os.BaseBundle.unparcel(BaseBundle.java:257)
        at android.os.BaseBundle.getString(BaseBundle.java:1086)
        at android.content.Intent.getStringExtra(Intent.java:7706)
        at com.android.server.am.ActivityStarter.startActivity(ActivityStarter.java:458)
        at com.android.server.am.ActivityStarter.startActivityLocked(ActivityStarter.java:409)
        at com.android.server.am.ActivityStarter.startActivityMayWait(ActivityStarter.java:1270)
        at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:6053)
        at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:5906)
        at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:121)
        at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3887)
        at android.os.Binder.execTransact(Binder.java:682)

@samtstern
Copy link
Contributor

@dimipaun can you help us try to reproduce the issue? Would help to know:

  • Device type and Android OS version
  • What code you're running to cause it
  • How often this happens

It's totally crazy to me that you're the only one reporting this issue! For something as basic as this I'd expect everyone to be yelling :-/

@dimipaun
Copy link
Contributor Author

dimipaun commented Sep 20, 2018

Yes, of course!

  • Samsung S9+ w/ Android 8.0.0
  • Firebase UI 4.2.1-SNAPSHOT
  • It happens ALL the time, both in devel (w/o ProGuard) and prod (w/ ProGuard)
  • The code is pretty vanilla:
        List<AuthUI.IdpConfig> idpConfigs = new ArrayList<>();
        for (ClientInfo.LoginMethod method: methods) {
            switch (method) {
                case FACEBOOK:
                    if (AppUtil.isFacebookMisconfigured(getContext())) {
                        Salute.warn(getContext(), "Facebook Sign-in is misconfigured", Toast.LENGTH_LONG).show();
                    } else {
                        idpConfigs.add(new AuthUI.IdpConfig
                                .FacebookBuilder()
                                .setPermissions(Arrays.asList("default", "email"))
                                .build());
                    }
                    break;
                case TWITTER:
                    if (AppUtil.isTwitterMisconfigured(getContext())) {
                        Salute.warn(getContext(), "Twitter Sign-in is misconfigured", Toast.LENGTH_LONG).show();
                    } else {
                        idpConfigs.add(new AuthUI.IdpConfig
                                .TwitterBuilder()
                                .build());
                    }
                    break;
                case GOOGLE:
                    if (AppUtil.isGoogleMisconfigured(getContext())) {
                        Salute.warn(getContext(), "Google Sign-in is misconfigured", Toast.LENGTH_LONG).show();
                    } else {
                        idpConfigs.add(new AuthUI.IdpConfig
                                .GoogleBuilder()
                                .setScopes(Arrays.asList("profile", "email"))
                                .build());
                    }
                    break;
                case EMAIL:
                    idpConfigs.add(new AuthUI.IdpConfig
                            .EmailBuilder()
                            .setRequireName(true)
                            .setAllowNewAccounts(true)
                            .build());
                    break;
                default:
                    Salute.warn(getContext(), "Login method not supported: " + method, Toast.LENGTH_SHORT).show();
            }
        }

Intent   intent = AuthUI.getInstance()
                    .createSignInIntentBuilder()
                    .setTheme(R.style.SplashTheme)
                    //.setLogo(R.drawable.ic_launcher)
                    .setAvailableProviders(idpConfigs)
                    .setTosAndPrivacyPolicyUrls(getString(R.string.terms_url), getString(R.string.privacy_url))
                    .setIsSmartLockEnabled(!BuildConfig.DEBUG)
                    .build();
startActivityForResult(intent, RC_FIREBASE_UI_SIGNIN);

Note, if there's only one element in the idpConfigs array, it works as it goes directly to that provider.

@SUPERCILEX
Copy link
Collaborator

Dang! 😞 Can you reproduce it on an emulator or a non Samsung device? Or is it just that device?

@SUPERCILEX
Copy link
Collaborator

SUPERCILEX commented Sep 20, 2018

Let's try this solution instead: ArthurHub/Android-Image-Cropper#332

@dimipaun
Copy link
Contributor Author

OK, working on it.

dimipaun added a commit to dimipaun/FirebaseUI-Android that referenced this issue Sep 20, 2018
dimipaun added a commit to dimipaun/FirebaseUI-Android that referenced this issue Sep 20, 2018
@dimipaun
Copy link
Contributor Author

PR #1453

@SUPERCILEX
Copy link
Collaborator

@samtstern Let's hope that fix-implemented label gets to stay! 🤞😆 @dimipaun Run ./gradlew --refresh-dependencies to get the new snapshot.

@dimipaun
Copy link
Contributor Author

Arrgghhh:

2018-09-21 12:51:04.663 1358-1609/? E/MotionRecognitionService: handleMessage: event 200 value : 1
2018-09-21 12:51:04.664 1358-3147/? E/Parcel: Class not found when unmarshalling: com.firebase.ui.auth.data.model.FlowParameters
    java.lang.ClassNotFoundException: com.firebase.ui.auth.data.model.FlowParameters
        at java.lang.Class.classForName(Native Method)
        at java.lang.Class.forName(Class.java:453)
        at android.os.Parcel.readParcelableCreator(Parcel.java:2835)
        at android.os.Parcel.readParcelable(Parcel.java:2789)
        at android.os.Parcel.readValue(Parcel.java:2692)
        at android.os.Parcel.readArrayMapInternal(Parcel.java:3059)
        at android.os.BaseBundle.unparcel(BaseBundle.java:257)
        at android.os.BaseBundle.getString(BaseBundle.java:1086)
        at android.content.Intent.getStringExtra(Intent.java:7706)
        at com.android.server.am.ActivityStarter.startActivity(ActivityStarter.java:458)
        at com.android.server.am.ActivityStarter.startActivityLocked(ActivityStarter.java:409)
        at com.android.server.am.ActivityStarter.startActivityMayWait(ActivityStarter.java:1270)
        at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:6053)
        at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:5906)
        at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:121)
        at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3887)
        at android.os.Binder.execTransact(Binder.java:682)
     Caused by: java.lang.ClassNotFoundException: com.firebase.ui.auth.data.model.FlowParameters
        at java.lang.Class.classForName(Native Method)
        at java.lang.BootClassLoader.findClass(ClassLoader.java:1355)
        at java.lang.BootClassLoader.loadClass(ClassLoader.java:1415)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at java.lang.Class.classForName(Native Method) 
        at java.lang.Class.forName(Class.java:453) 
        at android.os.Parcel.readParcelableCreator(Parcel.java:2835) 
        at android.os.Parcel.readParcelable(Parcel.java:2789) 
        at android.os.Parcel.readValue(Parcel.java:2692) 
        at android.os.Parcel.readArrayMapInternal(Parcel.java:3059) 
        at android.os.BaseBundle.unparcel(BaseBundle.java:257) 
        at android.os.BaseBundle.getString(BaseBundle.java:1086) 
        at android.content.Intent.getStringExtra(Intent.java:7706) 
        at com.android.server.am.ActivityStarter.startActivity(ActivityStarter.java:458) 
        at com.android.server.am.ActivityStarter.startActivityLocked(ActivityStarter.java:409) 
        at com.android.server.am.ActivityStarter.startActivityMayWait(ActivityStarter.java:1270) 
        at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:6053) 
        at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:5906) 
        at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:121) 
        at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3887) 
        at android.os.Binder.execTransact(Binder.java:682) 
     Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
2018-09-21 12:51:04.664 1358-3147/? W/Bundle: Failed to parse Bundle, but defusing quietly
    android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.firebase.ui.auth.data.model.FlowParameters
        at android.os.Parcel.readParcelableCreator(Parcel.java:2863)
        at android.os.Parcel.readParcelable(Parcel.java:2789)
        at android.os.Parcel.readValue(Parcel.java:2692)
        at android.os.Parcel.readArrayMapInternal(Parcel.java:3059)
        at android.os.BaseBundle.unparcel(BaseBundle.java:257)
        at android.os.BaseBundle.getString(BaseBundle.java:1086)
        at android.content.Intent.getStringExtra(Intent.java:7706)
        at com.android.server.am.ActivityStarter.startActivity(ActivityStarter.java:458)
        at com.android.server.am.ActivityStarter.startActivityLocked(ActivityStarter.java:409)
        at com.android.server.am.ActivityStarter.startActivityMayWait(ActivityStarter.java:1270)
        at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:6053)
        at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:5906)
        at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:121)
        at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3887)
        at android.os.Binder.execTransact(Binder.java:682)
2018-09-21 12:51:04.710 1358-1402/? W/CAE: unregisterCallback(ContextAwareService.java:217) - [unregi 01] Mutex is locked for AUTO_ROTATION

@dimipaun
Copy link
Contributor Author

Hmmm, same stacktrace, I wonder if I'm using the latest changes....

@samtstern
Copy link
Contributor

@dimipaun if you want to be triple sure:

  • Check out the dev branch of FirebaseUI
  • Change the version in Config.kt to something like 5.6.7-SNAPSHOT
  • Run ./gradlew clean :library:prepareArtifacts :library:publishAllToMavenLocal
  • In your app, add mavenLocal() to your repositories {} block
  • Depend on the version you made up

Then you can't be possibly running old code!

@dimipaun
Copy link
Contributor Author

dimipaun commented Oct 1, 2018

Hi @samtstern @SUPERCILEX on closer inspection, the code doesn't reach our activity, look at the stacktrace:

Caused by: java.lang.ClassNotFoundException: com.firebase.ui.auth.data.model.FlowParameters
        at java.lang.Class.classForName(Native Method)
        at java.lang.BootClassLoader.findClass(ClassLoader.java:1355)
        at java.lang.BootClassLoader.loadClass(ClassLoader.java:1415)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at java.lang.Class.classForName(Native Method) 
        at java.lang.Class.forName(Class.java:453) 
        at android.os.Parcel.readParcelableCreator(Parcel.java:2835) 
        at android.os.Parcel.readParcelable(Parcel.java:2789) 
        at android.os.Parcel.readValue(Parcel.java:2692) 
        at android.os.Parcel.readArrayMapInternal(Parcel.java:3059) 
        at android.os.BaseBundle.unparcel(BaseBundle.java:257) 
        at android.os.BaseBundle.getString(BaseBundle.java:1086) 
        at android.content.Intent.getStringExtra(Intent.java:7706) 
        at com.android.server.am.ActivityStarter.startActivity(ActivityStarter.java:458) 
        at com.android.server.am.ActivityStarter.startActivityLocked(ActivityStarter.java:409) 
        at com.android.server.am.ActivityStarter.startActivityMayWait(ActivityStarter.java:1270) 
        at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:6053) 
        at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:5906) 
        at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:121) 
        at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3887) 
        at android.os.Binder.execTransact(Binder.java:682) 

so whatever we add in:

public static FlowParameters fromIntent(Intent intent) {
        //this is required to fix #1416 - ClassNotFound for FlowParameters
        intent.setExtrasClassLoader(AuthUI.class.getClassLoader());
        return intent.getParcelableExtra(ExtraConstants.FLOW_PARAMS);
    }

will not work, right? Am I missing something?

Would it make sense to setExtrasClassLoader in HelperActivityBase where we create the intent? Right now we have:

        return new Intent(
                checkNotNull(context, "context cannot be null"),
                checkNotNull(target, "target activity cannot be null"))
                .putExtra(ExtraConstants.FLOW_PARAMS,
                        checkNotNull(flowParams, "flowParams cannot be null"));
                .putExtra(ExtraConstants.FLOW_BUNDLE,
                        checkNotNull(flowParams, "flowParams cannot be null").toBundle());
    }

maybe we do:

        Intent intent = new Intent(
                checkNotNull(context, "context cannot be null"),
                checkNotNull(target, "target activity cannot be null"))
                .putExtra(ExtraConstants.FLOW_PARAMS,
                        checkNotNull(flowParams, "flowParams cannot be null"));
                .putExtra(ExtraConstants.FLOW_BUNDLE,
                        checkNotNull(flowParams, "flowParams cannot be null").toBundle());

        intent.setExtrasClassLoader(AuthUI.class.getClassLoader());
        return intent;
    }

Thoughts?

@SUPERCILEX
Copy link
Collaborator

Go for it! 👍 Though it would be nice if you could test it locally first. 😊

@dimipaun
Copy link
Contributor Author

dimipaun commented Oct 1, 2018

I'd love to test locally, but frankly I haven't figured out how to build it and then use in the app.

@SUPERCILEX
Copy link
Collaborator

Where are you getting stuck? What error?

dimipaun added a commit to dimipaun/FirebaseUI-Android that referenced this issue Oct 6, 2018
This is because the exception happens _before_ we get to
read the FlowParameters from the extras/bundle.
samtstern pushed a commit that referenced this issue Oct 12, 2018
This is because the exception happens _before_ we get to
read the FlowParameters from the extras/bundle.
samtstern added a commit that referenced this issue Oct 12, 2018
samtstern added a commit that referenced this issue Oct 12, 2018
@dimipaun dimipaun reopened this Oct 13, 2018
samtstern added a commit that referenced this issue Oct 15, 2018
@SzasznikaJanos
Copy link

I got the same error

  • No ProGuard
  • Version (4.3.1)
  • All Dependencies are up to date
  • No Facebook Sdk.

Tested on multiple devices.
Failing on Samsung Note 4:

Model SM-N910
Android Version : 6.0.1

@samtstern
Copy link
Contributor

@SzasznikaJanos are you able to reproduce this easily? If so steps would be really helpful!

@ChrisKruegerDev
Copy link

I got the same error. Adding this line fixed it:
intent.setExtrasClassLoader(AuthUI::class.java.classLoader)

  • Debug mode (No ProGuard)
  • Version 6.0.2
  • All Dependencies are up to date
  • With Facebook SDK

Model SM-G930F
Android Version: 8.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants