2
アプリをリリースとして作成しようとしてエラーが発生しました。 今後のGsonでエラーが発生する可能性があります。 プロフェッショナルとしての役人として改装ガードをしている間に しかし、理由はわからないからです。Android proguard Gsonエラー
これらのライブラリは現在使用されています。使用されている
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
apt 'com.jakewharton:butterknife-compiler:8.4.0'
compile 'com.jakewharton:butterknife:8.4.0'
compile 'com.android.support:support-v4:24.1.1'
compile 'com.android.support:support-annotations:24.1.1'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'io.reactivex:rxandroid:1.2.1'
compile 'com.trello:rxlifecycle:0.6.1'
compile 'com.trello:rxlifecycle-components:0.6.1'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
compile 'com.squareup.okhttp3:okhttp:3.3.1'
compile 'com.squareup.okhttp3:okhttp-urlconnection:3.3.1'
compile 'com.squareup.okhttp3:logging-interceptor:3.3.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'jp.wasabeef:glide-transformations:2.0.1'
compile 'com.github.captain-miao:autofittextview:0.2.2'
compile 'com.artemzin.rxjava:proguard-rules:1.1.9.0'
とProGuardのは、以下のとおり
-libraryjars libs
-keepattributes SourceFile,LineNumberTable
-dontwarn okio.**
-dontnote retrofit2.Platform
-dontnote retrofit2.Platform$IOS$MainThreadExecutor
-dontwarn retrofit2.Platform$Java8
-keepattributes Signature
-keepattributes Exceptions
-keepattributes Signature
-keepattributes *Annotation*
-keep class sun.misc.Unsafe { *; }
-keep class com.google.gson.examples.android.model.** { *; }
-keep class com.google.gson.** { *; }
APKがよく行われます。ただし、次のエラーが発生した場合は実行します。
STACK_TRACE=java.lang.AssertionError: java.lang.NoSuchFieldException: OPTION
at com.google.gson.internal.bind.TypeAdapters$EnumTypeAdapter.<init> (TypeAdapters.java:808)
at com.google.gson.internal.bind.TypeAdapters$30.create(TypeAdapters.java:834)
at com.google.gson.Gson.getAdapter(Gson.java:423)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:115)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:164)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:100)
at com.google.gson.Gson.getAdapter(Gson.java:423)
at d.b.a.a.a(GsonConverterFactory.java:63)
at d.at.a(Retrofit.java:325)
at d.at.b(Retrofit.java:308)
at d.ax.c(ServiceMethod.java:704)
at d.ax.a(ServiceMethod.java:167)
at d.at.a(Retrofit.java:166)
at d.au.invoke(Retrofit.java:145)
at java.lang.reflect.Proxy.invoke(Proxy.java:393)
at $Proxy2.b(Unknown Source)
レトロフィットがこれを使用しています。
net = new Retrofit.Builder()
.baseUrl(SERVER_URL)
.addConverterFactory(GsonConverterFactory.create()) //Json Parser
.addCallAdapterFactory(RxJavaCallAdapterFactory.create()) //Rxandroid
.client(client)
.build()
.create(xxx.class);
ありがとうございます!それはうまく動作します。 – takk