java.io.InvalidClassException:
com.sungymobile.cache.resource.ResourceCacheLoader$ResourceCache;
local class incompatible: stream classdesc serialVersionUID = 6381106003702990139,
local class serialVersionUID = 3777451853403693248

- 168,305
- 31
- 280
- 331

- 209
- 2
- 9
1 Answers
Seems, that you have a serialized class, that does not provide fixed serial version parameter. You have to provide:
private static final long serialVersionUID = 0L;
With any long value in your class, which must to be cached. Due to Java Docs for Serializable interface:
The serialization runtime associates with each serializable class a version number, called a serialVersionUID, which is used during deserialization to verify that the sender and receiver of a serialized object have loaded classes for that object that are compatible with respect to serialization. If the receiver has loaded a class for the object that has a different serialVersionUID than that of the corresponding sender's class, then deserialization will result in an InvalidClassException. A serializable class can declare its own serialVersionUID explicitly by declaring a field named "serialVersionUID" that must be static, final, and of type long:
This value is needed to determine, wether cached instance is the same version with the current class, you have.

- 27,441
- 9
- 87
- 82
-
It can't be zero, or 'any long value'. The value required is `6381106003702990139L`. See the exception message. – user207421 Oct 08 '15 at 11:12
-
@EJP the value he've got is a random value, which is differs because his class doesn't provide a fixed serial version ID. If it does, then it's the problem of different class versions and no need to provide any other value, then it already has. But to provide some random value just because it was somehow peviewsly serialized and cached is a little bit strange, because we don't know exactly which version else were cached. So, we have to drop cache and add this field if it doesn't exist – Stanislav Oct 08 '15 at 11:31