1

I have an Android app which uses the Gson jar in the referenced libraries. I'm currently using version 2.2.4 and I have 2 phones to test it.

On a Samsung Galaxy S Advance 2.3.6 all works perfectly while on an LG Nexus 4 4.2.2 I got the error

The JAR gson-2.4.4 has no source attachment.

and in the Log file

java.Lang.StackoverflowError

Of course I correctly imported the needed libraries otherwise it wouldn't have worked on Android 2.3.6.

Do you have any suggestion?

Thanks

This is the Stack:

05-28 14:58:50.540: E/AndroidRuntime(1038): FATAL EXCEPTION: Thread-92
05-28 14:58:50.540: E/AndroidRuntime(1038): java.lang.StackOverflowError
05-28 14:58:50.540: E/AndroidRuntime(1038):     at               com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:355)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:117)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:72)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.Gson.getAdapter(Gson.java:356)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.<init>(ReflectiveTypeAdapterFactory.java:82)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:81)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:118)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:72)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.Gson.getAdapter(Gson.java:356)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.<init>(ReflectiveTypeAdapterFactory.java:82)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:81)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:118)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:72)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.Gson.getAdapter(Gson.java:356)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.<init>(ReflectiveTypeAdapterFactory.java:82)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:81)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:118)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:72)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.Gson.getAdapter(Gson.java:356)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.<init>(ReflectiveTypeAdapterFactory.java:82)
05-28 14:58:50.540: E/AndroidRuntime(1038):     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:81)
4

1 回答 1

2

This sounds like a bug related to changes made in newer Android versions. Without seeing the class you are trying to serialize it's hard to pin point the problem. This thread discusses the issue you're having and may point you in the right direction. If you're unable to locate the problem it sounds like reverting Gson to 1.7.1 will work.

于 2013-05-28T16:44:47.970 回答