-
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
Fatal Exception: java.lang.AssertionError: annotation value type != return type #1242
Comments
I see this exception (in Fabric) on Samsung S5 devices running Android OS 5.0, 5.0.1 and 5.0.2 As I look into Android source-code toAnnotationInstance() method for Android 5.0, I see that the exception is thrown here:
annotationClass here should be SerializedName.class I have seen this problem with a later Gson version. May be this is happening because S5 possibly bundles a older version of Gson in system class path, and hence isn't able to match the two classes? |
@swankjesse @JakeWharton Do you guys have any insights on what is causing this? |
Good idea. If you have such a device you should be able to detect if there’s a Gson on its system classpath. |
@swankjesse How do we detect that Gson is in system classpath? |
Run a program with no Gson and call Class.forName() to class load it! |
@swankjesse That wont work. In an app, Gson needs to detect if a different system classpath version is present and throw an appropriate error. |
@swankjesse Here is a solution which may help. |
My suggestion was intended as a way to detect if this is the root cause and not as something we'd ship. |
In the stack trace below, Gson is referred to at line 458 which is the current line number for factory.create() call for Gson. This indicates that the Gson instance is coming from the latest version of the Gson jar. For some weird reason, the SerializedName.class annotation is messed up in the dex? Fatal Exception: java.lang.AssertionError: annotation value type != return type |
@inder123 Have you found a way to fix this problem? Have you found the root cause of this problem? |
No, I didn't @elviswoo |
I've also seen this in my automatted crash reports, where Gson is not involved, on Samsung S5 running Android 5.0:
|
I am having the same bug for Samsung Galaxy S5 with Android 5.0 |
Fatal Exception: java.lang.AssertionError: annotation value type != return type
at libcore.reflect.AnnotationAccess.toAnnotationInstance(AnnotationAccess.java:649)
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.getFieldNames(ReflectiveTypeAdapterFactory.java:72)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:159)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:100)
at com.google.gson.Gson.getAdapter(Gson.java:423)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory.create(CollectionTypeAdapterFactory.java:53)
at com.google.gson.Gson.getAdapter(Gson.java:423)
at com.google.gson.Gson.fromJson(Gson.java:887)
at com.google.gson.Gson.fromJson(Gson.java:853)
at com.google.gson.Gson.fromJson(Gson.java:802)
at com.watchlivetv.onlineradioapp.sync.ZalunuSyncAdapter.parsingServerStation(ZalunuSyncAdapter.java:224)
at com.watchlivetv.onlineradioapp.sync.ZalunuSyncAdapter.performLocalSync(ZalunuSyncAdapter.java:186)
at com.watchlivetv.onlineradioapp.sync.ZalunuSyncAdapter.onPerformSync(ZalunuSyncAdapter.java:176)
at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:259)
The text was updated successfully, but these errors were encountered: