When android uploads json string, json key is replaced with abc

The uploaded json string is a map

class StudentInfo {

    public String name;

    public String age;

}



map.put("team", "team-a")

List<StudentInfo> data = buildData(xxx);

map.put("data", data);

Finally, use Gson to convert map to json string.

The packaged debug version behaves normally, the json string is as follows:

{

"team":"team-a",

"data":[

{"name":"tom", "age":"11"}

]

}

In the packaged release version, the problem encountered is that the server cannot parse the data after uploading it.

After checking the daily special, the uploaded content is wrong, the fields in StudentInfo are obfuscated, the name becomes a, and the age becomes b

{

"team":"team-a",

"data":[

{"a":"tom", "b":"11"}

]

}

Solution:

The simplest method currently used is to avoid confusion,

-keep

reference:

https://www.jianshu.com/p/a8a2e3f1ca60

-keep class  xx.xx.** {*;}

Guess you like

Origin blog.csdn.net/wuzhong8809/article/details/107644973