Friday 11 May 2012

Android(Java) - gson\json deserialization error

Android Blog With example

Hello Friends,
     I found a strange issue in android application , My application is running 
     Fine but in few of the device(like:HTC Explorer, HTC Desire.....) its gives  
     parsing error.....
           JsonParseException: The JsonDeserializer  
           DefaultTypeAdapters$CollectionTypeAdapter@4e76fba0 failed to
            deserialize ...
   After doing a lot of investigation  , Here are the steps which I follow to fixed 
   this issue:
    1) Download jarjar (
    2) Put jarjar-1.3.jar and gson-2.1.jar in the same folder
    3) Create a new text file in this folder (rules.txt)
    4) Write the following line in the textfile:     
   5) From the command line, go in to the folder where you placed 
        jarjar-1.3.jar and gson-2.1.jar and run the following 
      "java -jar jarjar.jar process rules.txt gson-2.1.jar myjson-2.1.jar"  
  6) Replace the gson library in your project with myjson and
      update the imports.
  Hope this will helps you!
  cheers! :)
  Happy coding....... 


Copyright @ 2013 Android Developers Blog.