Gson proguard 적용시 에러..


안드로이드 프로젝트에 Proguard를 적용하는 중 Gson에서 버그가 발생하여 질문 올립니다.

proguard-ruls.pro

-keepattributes Signature
-keepattributes *Annotation*
-keep class kr.co.co.company.model.** { *; }
-keepclassmembers class kr.co.co.company.mode.** { *; }
-keep class sun.misc.Unsafe { *; }
-keep class com.google.gson.stream.** { *; }
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

Error Log

07-31 02:10:27.313 16727-16727/kr.co.company E/AndroidRuntime: FATAL EXCEPTION: main
                                                              Process: kr.co.company, PID: 16727
                                                              java.lang.IllegalArgumentException: class e.h$b declares multiple JSON fields named a
                                                                  at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:170)
                                                                  at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:100)
                                                                  at com.google.gson.Gson.getAdapter(Gson.java:423)
                                                                  at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:56)
                                                                  at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:125)
                                                                  at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:243)
                                                                  at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69)
                                                                  at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:125)
                                                                  at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:243)
                                                                  at com.google.gson.Gson.toJson(Gson.java:669)
                                                                  at com.google.gson.Gson.toJson(Gson.java:648)
                                                                  at com.google.gson.Gson.toJson(Gson.java:603)
                                                                  at com.google.gson.Gson.toJson(Gson.java:583)
                                                                  at kr.co.company.g.c.a(GsonUtil.java:33)
                                                                  at kr.co.company.global.c.a(GlobalFunction.java:166)
                                                                  at kr.co.company.activity.IndexActivity$2.a(IndexActivity.java:87)
                                                                  at e.g$a$1$1.run(ExecutorCallAdapterFactory.java:70)
                                                                  at android.os.Handler.handleCallback(Handler.java:751)
                                                                  at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                  at android.os.Looper.loop(Looper.java:154)
                                                                  at android.app.ActivityThread.main(ActivityThread.java:6317)
                                                                  at java.lang.reflect.Method.invoke(Native Method)
                                                                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872)
                                                                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)

감사합니다!!

  • 2017년 07월 31일에 작성됨
    java, android, python, Django...

조회수 92


1 답변


좋아요
0
싫어요
채택취소하기

해결했습니다.

  • 2017년 07월 31일에 작성됨
    java, android, python, Django...

로그인이 필요한 기능입니다.

Hashcode는 개발자들을 위한 무료 QnA사이트 입니다. 작성한 답변에 다른 개발자들이 댓글을 작성하거나 좋아요/싫어요를 할 수 있기 때문에 계정을 필요로 합니다.
► 로그인
► 계정만들기
Close