Android 和 PC 之间的序列化对象(Dalvik 与 JVM)
我正在与一个大型库 weka 合作,我想在 PC 版本和 Android 版本之间传输实例。我宁愿不必重写两者之间的整个序列化,但无论我将其更改为什么 UID,我总是会收到此错误:
java.io.InvalidClassException: [Lweka.classifiers.functions.MultilayerPerceptron$NeuralEnd;; Incompatible class (SUID): [Lweka.classifiers.functions.MultilayerPerceptron$NeuralEnd;: static final long serialVersionUID =-359311387972759020L; but expected [Lweka.classifiers.functions.MultilayerPerceptron$NeuralEnd;: static final long serialVersionUID =1920571045915494592L;
看起来数组本身具有错误的 SUID,因为这些数字与分配给班级的编号。有解决方法吗?
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.MultilayerPerceptron$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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您能提供更多代码吗?它看起来像是 dalvikvm 核心库中可能存在的错误,如果报告的话可以修复。 Dalvik 有一个公共错误跟踪器< /a> 用于审查和报告错误。
无论存在什么错误,您都应该能够通过添加 serialVersionUID 来解决该问题领域到你的班级。
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.