-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2.8.5;NullPointerException;TypeAdapterFactory #1578
Comments
help |
It would be good if you can provide the context that someone else can reproduce this error from :) |
any updates on this ? |
@aalaprawat if you are experiencing a similar exception, perhaps you could add some details about what you are doing when the exception occurs? What the Gson setup is and what the JSON input is that triggers the problem. |
Iam not able to replicate this issue on my device. But various devices are facing this issue across various android api levels in production app.
|
Unfortunately Gson does not check for |
I don't think this could be null |
@aalaprawat, were you able to reproduce this locally with a debug build of your application as well? Could you please try to create a small self-contained sample project using the latest Gson version which shows this issue? |
Currently, I am using Gson 2.8.6, would upgrading resolve the issue? |
I am afraid using the latest version most likely does not make a big difference, but in case this is really a Gson bug it would avoid having to track down bugs in an old Gson version. Future Gson versions will also add validation for the The stack trace suggests that somehow Since you mentioned it only occurs on some devices, maybe there is something wrong with those devices, or the Android version they are running. |
facing issues across all the devices and API versions, As mentioned above through code snippet, I can't point where |
Are you still experiencing this with the latest Gson version (currently 2.10.1)? It includes the |
I am going to close this because no answer has been provided. If you still experience this with the latest Gson version, feel free to comment here again with more details. |
java.lang.NullPointerException: Attempt to invoke interface method 'com.google.gson.TypeAdapter com.google.gson.TypeAdapterFactory.create(com.google.gson.Gson, com.google.gson.reflect.TypeToken)' on a null object reference
at com.google.gson.Gson.getAdapter(Gson.java:458)
at com.google.gson.Gson.fromJson(Gson.java:926)
at com.google.gson.Gson.fromJson(Gson.java:892)
at com.google.gson.Gson.fromJson(Gson.java:841)
at com.google.gson.Gson.fromJson(Gson.java:813)
The text was updated successfully, but these errors were encountered: