Skip to content Skip to sidebar Skip to footer

Android Hashtable Serialization

I am having a weird issue with serialization of a Hashtable. I have made a Server, Client app. Where server(PC/MAC) is serializing a Hashtable and sending it to Client(Android) thr

Solution 1:

Do not use serialization between architectures. There is no guarantee that a serialized Dalvik VM object tree will be in a format that is compatible with a JavaSE/JavaEE environment. Please use XML, JSON, Protocol Buffers, Thrift, etc. for transferring structured data between architectures.

Solution 2:

Far too late, but for anyone else who comes across this:

Noting what commonsware said above (Don't say you weren't warned):

I got over this by using the trove libraries and using long object maps. I realise that if dalvik or Java changes the serialization I am stuffed, but serialization is so much easier than the alternatives and that error message (whilst benign) does mean a lot of unnecessary allocations and overhead. On top of this I use proguard to reduce the library down to the 45K (out of ~1M) that I need. I would also suggest that you keep a copy of the trove source code in case they change their serialization, and also note that I needed 3.0.0 rc1 to get it to work (not sure the serialid's necessarily match between versions).

Post a Comment for "Android Hashtable Serialization"