JSON数据原文

[
    {id:1,name:"酒吞童子",cv:"阪口周平"},
    {id:2,name:"茨木童子",cv:"福山润"},
    {id:3,name:"大天狗",cv:"前野智昭"},
    {id:4,name:"荒川之主",cv:"子安武人"}
]

过程

进行GSON依赖的引入

compile 'com.google.code.gson:gson:2.2.4'

建立对应的 Java bean 类

public class Shikigami{
        @SerializedName("id")// 为防止混淆后无法匹配
        public int id;
        @SerializedName("name")
        public String name;
        @SerializedName("cv")
        public String cv;

        public int getId() {
            return id;
        }

        public void setId(int id) {
            this.id = id;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getCv() {
            return cv;
        }

        public void setCv(String cv) {
            this.cv = cv;
        }
    }

使用Gson进行解析

//  解析JSON数据
Gson gson = new Gson();
List<Shikigami> shikigamiLists = gson.fromJson(json, new TypeToken<List<Shikigami>>() {}.getType());
// 取得数据
String name = shikigamiLists.get(index).name;
tring cv = shikigami.get(index).cv;

Release混淆设置

-dontwarn
# okhttp混淆配置
-keep class com.squareup.okhttp.** { *;}
-dontwarn com.squareup.okhttp.**
-dontwarn okio.**
# Gson混淆配置
-keepattributes Signature
-keepattributes *Annotation*
-keep class sun.misc.Unsafe { *; }
-keep class com.google.gson.stream.** { *; }
# Application classes that will be serialized/deserialized over Gson 下面替换成自己的实体类

大功告成!