Recent site activity

Gson on Android

GSON works on Android!

Working around TypeNotPresentExceptions

Certain HTC phones have been reported to include their own, out-of-date copy of GSON on the system classpath. To work-around this, repackage GSON in your application's own package. Here's advice from issue 255:
1) Download jarjar (http://code.google.com/p/jarjar/downloads/list)
2) Put jarjar-1.0.jar and gson-1.5.jar in the same folder
3) Create a new text file in this folder (rules.txt)
4) Write the following line in the textfile: rule com.google.gson.** com.google.myjson.@1
5) From the commandline, open jarjar with the command "java -jar jarjar.jar process rules.txt gson-1.5.jar myjson-1.5.jar"
6) Replace the gson library in your project with myjson and update the imports

Comments