gpt4 book ai didi

android - IncompatibleClassChangeError com.google.gson.annotations.SerializedName.value

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:06:26 25 4
gpt4 key购买 nike

当用户从 Play 商店更新应用程序时,Samsung 设备中出现 IncompatibleClassChangeError。请检查以下日志。

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)

代码如下:

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;
}

LoginResponse 是我的 POJO 类。

preferences.getString("User", "")

将返回服务器响应的 JSON 字符串。

最佳答案

看起来像是三星的问题。很多人不仅对 gson 库有同样的问题,对其他库也有同样的问题。我认为你对此无能为力,只能等待三星开发人员解决这个问题.. 这个问题已经在三星开发者论坛上提出了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 团队成员之一提到的,如果有人可以将错误报告分享给团队,他们可以尽快解决此问题。

After reproducing the issue, navigate to developer settings, ensure ‘USB debugging’ is enabled, then enable ‘Bug report shortcut’. To take bug report, hold the power button and select the ‘Take bug report’ option.

Note: Please upload the bug report to google drive and share the folder to android-bugreport@google.com, then share the link here.

关于android - IncompatibleClassChangeError com.google.gson.annotations.SerializedName.value,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36324416/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com