问题
In debug, my code works fine. When I release my apk with proguard 5, Proguard offuscate my variables, and when I try to "Jsonify", the resulting string is offuscated, and so, my PHP script doesn't understand anything.
Here's my code:
ArrayList lCapturas=...;
if (lCapturas != null) {
Gson gson = new Gson();
Type listOfCapturaObject = new TypeToken<List<Captura>>() {
}.getType();
json = gson.toJson(lCapturas, listOfCapturaObject);
}
and my Json string
[{"j":"2014-09-10 17:35:25","e":"2014-09- 10","f":"19.3641107,-99.1785061","d":28809,"c":85,"b":2705,"a":1,"l":1,"m":0}]
I guess I must say Proguard not offuscate Captura Objects. Is there a way of disabling that option? Or how should I do???
回答1:
I resolved the issue :
-keep class com.pkg.vo.myClass { *; }
for each class I need to keep the variable names.
StackOverflow didn't saved my day :(
来源:https://stackoverflow.com/questions/25776318/proguard-and-gson-convert-variable-name-inside-arraylist