How should I use proguard with ormlite library on Android?
Trying this:
-keep class com.j256.**
-keepclassmembers class com.j256.**
-keep enum com.j256.**
-keepclassmembers enum com.j256.**
-keep interface com.j256.**
-keepclassmembers interface com.j256.**
But I get:
03-23 20:23:54.518: E/AndroidRuntime(3032): java.lang.RuntimeException: Unable to start activity ComponentInfo{cz.eman.android.cepro/cz.eman.android.cepro.activity.StationsOverviewActivity}: java.lang.IllegalStateException: Could not find constructor that takes a Context argument for helper class class kb
I also tried to add this:
-keepclassmembers class * { public <init>(android.content.Context); }
But I get another classmembers errors.
A small addition to the configuration above - if you're trying to serialize / deserialize Joda's
DateTime
objects via ORMLite, you probably need this as well:...since ORMLite's
DateTimeType
does everything via reflection.I've came up with such solution (maybe will work for somebody too).
Made such changes to
proguard.cfg
:Added
-dontobfuscate
optionAppended
,!code/allocation/variable
to-optimization
optionAPK file size using such configuration reduced from 580 kB to 250 kB.
Though, no obfuscation is performed.