mstian06 / google-gson

Automatically exported from code.google.com/p/google-gson
0 stars 0 forks source link

Crash after running ProGuard with several libraries #561

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use AndroidAnnotations with GSON as Converter. (Basically Spring REST)
2. Run Proguard with the config I'm attaching.
3. Run App.

What is the expected output? What do you see instead?
It should work, but for some reason, the code is crashing with the following 
error:

java.lang.AssertionError
        at com.google.gson.internal.bind.TypeAdapters$EnumTypeAdapter.<init>(Unknown Source)
        at com.google.gson.internal.bind.TypeAdapters$26.create(Unknown Source)
        at com.google.gson.Gson.getAdapter(Unknown Source)

This is being run for Android.

I created a post in SO though.

Any tips are so appreciated.

Thanks.

http://stackoverflow.com/questions/21864912/is-there-any-way-to-obfuscate-just-r
eal-code-and-not-ofuscate-libraries

Original issue reported on code.google.com by sergiCas...@gmail.com on 19 Feb 2014 at 12:58

Attachments:

GoogleCodeExporter commented 9 years ago
If you are using ProGuard on these enums you cannot guarantee their value 
inside the JSON. You need to register a custom TypeAdapter (or 
TypeAdapterFactory) which uses a property other than the .name() so that you 
can lookup the correct enum field based on the unobfuscated name inside the 
JSON.

Original comment by j...@squareup.com on 9 Aug 2014 at 6:06