开发者

Serializing object between Android and PC (Dalvik vs JVM)

开发者 https://www.devze.com 2023-02-17 02:12 出处:网络
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 re

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

精彩评论

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