Skip to content Skip to sidebar Skip to footer

Android: Cast String With Gson (proguard)

I use the below code to cast a string (containing json) into an Object (Category): String jsonInfo = '{'id':'GAME','name':'game','subCategories':[{'subId':'ALL','subName':'All game

Solution 1:

Json uses reflection to retrieve the generic signatures of the getters and setters. ProGuard discards those by default, so you should tell it to preserve them:

-keepattributes Signature

Note that recent versions of the Android SDK have deprecated proguard.cfg in favor of a file proguard-project.txt that is essentially empty, with the bulk of the configuration in a shared internal configuration file (all specified in project.properties).

Furthermore, you should not add -injars or -libraryjars options to your configuration, since the standard Ant/Eclipse/Gradle build processes automatically specify these for you.

Post a Comment for "Android: Cast String With Gson (proguard)"