Object serialization between Android and PC (Dalvik vs JVM)

I work with a large library, weka, and I would like to transfer instances between the PC version and the Android version. I would prefer not to rewrite the entire serialization between the two, but no matter what UID I change things for, 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 appears that the array itself has the wrong SUID, since these numbers do not match the number assigned to the class. Is there a workaround?

+4
source share
1 answer

Could you provide more code? This seems like a possible error in the dalvikvm core libraries, which can be fixed if reported. Dalvik has a public error tracker for viewing and reporting errors.

Regardless of the error, you must solve this problem by adding serialVersionUID to your class.

+1
source

Source: https://habr.com/ru/post/1344001/


All Articles