I`ve published an android app, obfuscated by dexguard. Everything seems to be fine, except for the Galaxy Tab 3 10.1 and only with Android 4.4, which is the only device, that reports errors to the developer console.
I get following exception:
java.lang.RuntimeException: Missing type parameter.
at com.google.gson.reflect.TypeToken.<init>(:62)
at com....util.Helper$2.<init>(:398)
Code in class Helper.java and line 398
return (Config) getSerializable(context, CONFIG, new TypeToken<Config>(){}.getType());
My dexguard rules:
# 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
Not only that I can not reproduce the error myself (i also have an Galaxy Tab 3 with Android 4.2, update not available yet), it only concerns the above mentioned device.
My solution was to avoid the use of the TypeToken and updating dexguard to the latest version.
For example:
Instead of
use this