我目前遇到以下异常:
eglSurfaceAttrib not implemented
Failed to set EGL_SWAP_BEHAVIOR on surface 0x9e878060, error=EGL_SUCCESS
com.esotericsoftware.kryo.KryoException: Unable to find class: ����(
Serialization trace:
badQuality (de.myproject.data.transform.MyPendingUpload)
at com.esotericsoftware.kryo.util.DefaultClassResolver.readName(DefaultClassResolver.java:138)
at com.esotericsoftware.kryo.util.DefaultClassResolver.readClass(DefaultClassResolver.java:115)
at com.esotericsoftware.kryo.Kryo.readClass(Kryo.java:641)
at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:99)
at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:528)
at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:657)
at com.snappydb.internal.DBImpl.get(DBImpl.java:249)
at de.myproject.data.storage.SnappyKeyValueDatabase.get(SnappyKeyValueDatabase.java:39)
at de.myproject.data.transform.MyServiceImpl$1$3.call(MyServiceImpl.java:230)
at de.myproject.data.transform.MyServiceImpl$1$3.call(MyServiceImpl.java:224)
at rx.Observable$2.call(Observable.java:162)
at rx.Observable$2.call(Observable.java:154)
at rx.Observable$2.call(Observable.java:162)
at rx.Observable$2.call(Observable.java:154)
at rx.Observable.unsafeSubscribe(Observable.java:7710)
at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:231)
at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:140)
at rx.internal.operators.OperatorMap$1.onNext(OperatorMap.java:55)
at rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber.pollQueue(OperatorObserveOn.java:208)
at rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber$2.call(OperatorObserveOn.java:170)
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.ClassNotFoundException: Invalid name: ����(
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:308)
at com.esotericsoftware.kryo.util.DefaultClassResolver.readName(DefaultClassResolver.java:136)
... 28 more
我正在尝试通过使用SnappyDB在设备上存储数据来为Android应用程序构建离线模式。
因此,当用户没有活动的互联网连接时,会存储数据,当互联网连接可用时,应该读取数据并将其上传到服务器。
PendingUpload类如下所示:
public final class PendingUpload implements Serializable {
final SomeModel someModel;
final Map<String, Image> images = new HashMap<>();
Quality goodQuality;
Quality badQuality;
Image someImage;
String string1;
String string2;
String string3;
List<Pair<SomeClass, AnotherClass>> someList;
List<Attachment> attachments;
public MyPendingUpload(SomeModel someModel) {
this.someModel = someModel;
}
protected MyPendingUpload() {
someModel = null;
}
}
我的Snappy数据库看起来像这样:
public class SnappyKeyValueDatabase implements KeyValueDatabase {
public static final String KEY_PREFIX = "snappyKeyValueDatabase_";
@NonNull
private final DB db;
public SnappyKeyValueDatabase(@NonNull DB db) {
this.db = db;
}
@Override
public void put(String key, Object object) throws IOException {
try {
db.put(KEY_PREFIX + key, object);
} catch (SnappydbException e) {
XLog.x(e);
throw new IOException(e);
}
}
@Override
public <T> T get(String key, Class<T> clazz) throws IOException {
try {
return (T) db.get(KEY_PREFIX + key, (Class<Serializable>) clazz);
} catch (SnappydbException e) {
XLog.x(e);
throw new IOException(e);
}
}
@Override
public void delete(String key) throws IOException {
try {
db.del(KEY_PREFIX + key);
} catch (SnappydbException e) {
XLog.x(e);
throw new IOException(e);
}
}
@Override
public Collection<String> list() throws IOException {
try {
String[] keys = db.findKeys(KEY_PREFIX);
ArrayList<String> resultList = new ArrayList<>(keys.length);
for (String key : keys) {
resultList.add(key.substring(KEY_PREFIX.length()));
}
return resultList;
} catch (SnappydbException e) {
XLog.x(e);
throw new IOException(e);
}
}
}
如果您需要更多信息,请告诉我们。 我暂时坚持这个问题一段时间,并感谢任何帮助。提前谢谢!