Android library Gson on Mobile does not work

2

The problem I have is that in my Android application I am using an object

asked by Ray 08.05.2016 в 15:47
source

1 answer

1

I have not had any problems using Gson , but I noticed that it does not work when I upload the .apk on a physical device, so based on a short search I found that there is a problem with the configuration in proguard which causes the problem, I did not have problems surely because I have configured as the following within my proguard file.

##---------------Begin: proguard configuration for Gson  ----------
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature

# Gson specific classes
-keep class sun.misc.Unsafe { *; }
#-keep class com.google.gson.stream.** { *; }

# Application classes that will be serialized/deserialized over Gson
# -keep class mypersonalclass.data.model.** { *; }
-keep class com.google.gson.examples.android.model.** { *; }

Review the settings taken from: link Y link

    
answered by 09.05.2016 в 00:16