Git Product home page Git Product logo

Comments (7)

johncarl81 avatar johncarl81 commented on August 10, 2024

What version of Parceler are you using?

I just tried this out hoping to find a problem... unfortunately it works for me just fine.

This SO post mentions setting the classloader manually when reading from the Bundle: http://stackoverflow.com/questions/11393751/badparcelableexception-classnotfoundexception-when-unmarshalling

Can you try something like the following in your onActivityCreated() method:

bundle.readParceleable(FragmentClass.class.getClassLoader());

from parceler.

konradg avatar konradg commented on August 10, 2024

OK, problem turned out to be related to SupportMapFragment from Google Play Services rather than the library. More details here:
http://stackoverflow.com/questions/14612336/classnotfoundexception-reading-a-serializable-object-in-a-class-extending-mapfra
I'm extremely sorry for blaming Parceler for this. Issue closed as it's totally invalid. And thanks for the awesome lib!

from parceler.

johncarl81 avatar johncarl81 commented on August 10, 2024

No worries @konradg , glad you found a solution... And you're welcome!

from parceler.

ardoramor avatar ardoramor commented on August 10, 2024

I'm getting the same exception when trying to explicitly add an account with AccountManager's user data:

SessionToken sessionToken = mAuthClient.login(username, password);

Bundle userData = new Bundle();
userData.putParcelable(KEY_SESSION_DETAILS, Parcels.wrap(sessionToken));

final Account account = new Account(accountName, accountType);

// throws android.os.BadParcelableException
mAccountManager.addAccountExplicitly(account, null, userData);

The following is the exception trace:

10353-10353/com.abcdef.production E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.abcdef.production, PID: 10353
    android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.abcdef.uv.model.SessionToken$$Parcelable
            at android.os.Parcel.readException(Parcel.java:1474)
            at android.os.Parcel.readException(Parcel.java:1426)
            at android.accounts.IAccountManager$Stub$Proxy.addAccountExplicitly(IAccountManager.java:719)
            at android.accounts.AccountManager.addAccountExplicitly(AccountManager.java:612)
            at com.abcdef.ui.LoginActivity.completeAuthentication(LoginActivity.java:316)
            at com.abcdef.ui.LoginActivity.access$500(LoginActivity.java:38)
            at com.abcdef.ui.LoginActivity$AuthenticateUserTask.onPostExecute(LoginActivity.java:235)
            at com.abcdef.ui.LoginActivity$AuthenticateUserTask.onPostExecute(LoginActivity.java:171)
            at android.os.AsyncTask.finish(AsyncTask.java:632)
            at android.os.AsyncTask.access$600(AsyncTask.java:177)
            at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5146)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
            at dalvik.system.NativeStart.main(Native Method)

I tried setting class loader of activity but that didn't fix the issue:

userData.setClassLoader(this.getClassLoader());

Is this a fault on my, AccountManager's, or Parceler's side?

from parceler.

johncarl81 avatar johncarl81 commented on August 10, 2024

Can you verify that SessionToken$$Parcelable is generated?

from parceler.

ardoramor avatar ardoramor commented on August 10, 2024

Yep, it is generated and I'm able to successfully wrap and unwrap it in other instances. However, I think I might have jumped the gun. I've read up more on AccountManager's userData and see that, although it does that a bundle, the bundle should only store String objects. Its not very obvious but it makes sense. Just ignore the above post :) !

from parceler.

johncarl81 avatar johncarl81 commented on August 10, 2024

Gotcha, glad you found a solution. As always, feel free to post if anything else doesn't behave the way it should.

from parceler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.