Comments (7)
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.
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.
No worries @konradg , glad you found a solution... And you're welcome!
from parceler.
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.
Can you verify that SessionToken$$Parcelable
is generated?
from parceler.
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.
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)
- Ability to treat reflection warnings as errors HOT 5
- Parceler fails when used with with Lifecycle-viewmodel 2.2.0 HOT 7
- Facing Vulnerabilities in parceler library HOT 1
- Facing Vulnerabilities in parceler library HOT 1
- Polymorphism documentation not updated? HOT 6
- Cannot get working with navigation graph HOT 1
- Crashing on background HOT 4
- ParcelAnnotationProcessor.process take lot amount of time. HOT 15
- Unable to find generated Parcelable class HOT 1
- error: Parceler: Code generation did not complete successfully. HOT 47
- Cant find class to parcel ! HOT 1
- Can't generate code HOT 3
- Unable to Marshall with Parceler HOT 2
- Errors in HashMap$$PackageHelper HOT 3
- cannot running with kapt HOT 1
- Parceler: Code generation did not complete successfully. org.parceler.transfuse.transaction.TransactionRuntimeException: Encountered ErrorType <error>, unable to recover HOT 4
- [Request Feature] Support for Kotlin Symbol Processing
- Parceler code generation fails on AS 2023.3.1
- Getters and Setter Alphabetically Order for Write and Read
- Not sure how to convert a Cursor
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from parceler.