我已经发布了一个被 dexguard 混淆的 android 应用程序。一切似乎都很好,除了 Galaxy Tab 3 10.1 并且只有 Android 4.4 是唯一向开发者控制台报告错误的设备。
我得到以下异常:
java.lang.RuntimeException: Missing type parameter.
at com.google.gson.reflect.TypeToken.<init>(:62)
at com....util.Helper$2.<init>(:398)
类 Helper.java 和第 398 行中的代码
return (Config) getSerializable(context, CONFIG, new TypeToken<Config>(){}.getType());
我的 dexguard 规则:
# For using GSON @Expose annotation
-keepattributes *Annotation*
# Gson specific classes
-keep class sun.misc.Unsafe { *; }
# Application classes that will be serialized/deserialized over Gson
# path to the config class: com/.../models/config/Config.java;
-keep class com....models.** { *; }
-keepattributes Signature
不仅我自己无法重现该错误(我还有一个带有 Android 4.2 的 Galaxy Tab 3,更新尚不可用),它只涉及上述设备。