开发者

Serializing object between Android and PC (Dalvik vs JVM)

I'm working with a large library, weka, and I'd like to transfer instances between the PC version and Android version. I'd rather not have to rewrite the entire serialization between the two, but reguardless of what UID I change things to, I always get this error:

java.io.InvalidClassException: [Lweka.classifiers.functions.MultilayerPerceptron$NeuralEnd;; Incompatible class (SUID): [Lweka.classifiers.functions.M开发者_如何学运维ultilayerPerceptron$NeuralEnd;: static final long serialVersionUID =-359311387972759020L; but expected [Lweka.classifiers.functions.MultilayerPerceptron$NeuralEnd;: static final long serialVersionUID =1920571045915494592L;

It would appear the array itself has the wrong SUID, as those numbers don't match the number assigned to the class. Is there a workaround?


Could you provide more code? It looks like a possible bug in the dalvikvm core libraries, which can be fixed if it is reported. Dalvik has a public bug tracker for reviewing and reporting bugs.

Regardless of the bug, you should be able to work-around the problem by adding a serialVersionUID field to your class.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜