Proguard and Gson - Convert variable name inside arraylist

自古美人都是妖i 提交于 2020-01-30 10:59:48

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!