我们正在IncompatibleClassChangeError在三星设备时,从Play商店用户更新应用.请检查下面的日志.
java.lang.IncompatibleClassChangeError: Couldn't find com.google.gson.annotations.SerializedName.value
at libcore.reflect.AnnotationAccess.toAnnotationInstance(AnnotationAccess.java:659)
at libcore.reflect.AnnotationAccess.toAnnotationInstance(AnnotationAccess.java:641)
at libcore.reflect.AnnotationAccess.getDeclaredAnnotation(AnnotationAccess.java:170)
at java.lang.reflect.Field.getAnnotation(Field.java:242)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getFieldName(ReflectiveTypeAdapterFactory.java:71)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getFieldName(ReflectiveTypeAdapterFactory.java:67)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:142)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:83)
at com.google.gson.Gson.getAdapter(Gson.java:359)
at com.google.gson.Gson.fromJson(Gson.java:809)
at com.google.gson.Gson.fromJson(Gson.java:775)
at com.google.gson.Gson.fromJson(Gson.java:724)
at com.google.gson.Gson.fromJson(Gson.java:696)
at com.cubii.utils.SessionManager.getUserID(SessionManager.java:70)
at com.cubii.BluetoothLeService.broadcastUpdate(BluetoothLeService.java:188)
at com.cubii.BluetoothLeService.access$400(BluetoothLeService.java:47)
at com.cubii.BluetoothLeService$1.onCharacteristicChanged(BluetoothLeService.java:139)
at android.bluetooth.BluetoothGatt$1.onNotify(BluetoothGatt.java:443)
at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:399)`enter code here`
at android.os.Binder.execTransact(Binder.java:446)
Run Code Online (Sandbox Code Playgroud)
代码如下:
public int getUserID(){
try {
String json = preferences.getString("User", "");
LoginResponse loginResponse = new Gson().fromJson(json, LoginResponse.class);//getting error from this line
Integer id = 0;
if (loginResponse != null) {
if (loginResponse.getId() != null) {
id = loginResponse.getId();
} else {
id = loginResponse.getUserId();
}
}
return (id == null) ? 0 : id;
}catch (Exception e){
Logger.dump(e);
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
LoginResponse是我的POJO课程.
preferences.getString("User", "")
Run Code Online (Sandbox Code Playgroud)
将返回JSON字符串,这是服务器响应.
看起来像三星问题..很多人不仅与gson lib有同样的问题,而且还有其他的库.我认为你不能做太多,只等三星开发人员解决这个问题.已经这个问题在三星开发者论坛上提出http://developer.samsung.com/forum/board/thread/view.do?boardName=General&messageId=280930
这里有更多关于此问题的报告,它只影响三星设备. https://code.google.com/p/android/issues/detail?id=172339
编辑
他们中的一些人也在三星以外的设备上遇到这个问题,所以它可能不完全是三星的故障.此问题已分配给Google小组.作为Google小组成员之一,如果有人可以向小组分享错误报告,他们可以尽快解决此问题.
重现问题后,导航到开发人员设置,确保启用"USB调试",然后启用"错误报告快捷方式".要获取错误报告,请按住电源按钮并选择"获取错误报告"选项.
注意:请将错误报告上传到谷歌硬盘并将文件夹分享到android-bugreport@google.com,然后在此处分享链接.
| 归档时间: |
|
| 查看次数: |
2353 次 |
| 最近记录: |