Proguard with OrmLite on Android

sealskej picture sealskej · Mar 24, 2012 · Viewed 11.3k times · Source

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.

Answer

German picture German · Apr 23, 2012

Thank you a lot for posts like this that help us to advance step by step.

I've came up with other solution after i have tried the last one without success:

# OrmLite uses reflection
-keep class com.j256.**
-keepclassmembers class com.j256.** { *; }
-keep enum com.j256.**
-keepclassmembers enum com.j256.** { *; }
-keep interface com.j256.**
-keepclassmembers interface com.j256.** { *; }

I hope it can help someone.