Proguard的与OrmLite在AndroidProguard、OrmLite、Android

2023-09-12 06:20:23 作者:温柔似野鬼

我应该如何使用ProGuard的与ormlite库在Android?

How should I use proguard with ormlite library on Android?

尝试这样的:

-keep class com.j256.**
-keepclassmembers class com.j256.**
-keep enum com.j256.**
-keepclassmembers enum com.j256.**
-keep interface com.j256.**
-keepclassmembers interface com.j256.**

但我得到:

03-23​​ 20:23:54.518:E / AndroidRuntime(3032):java.lang.RuntimeException的:无法启动的活动ComponentInfo {cz.eman.android.cepro / cz.eman.android.cepro.activity.StationsOverviewActivity }:java.lang.IllegalStateException:找不到构造函数上下文参数的辅助类类KB

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

我也尝试添加这样的:

-keepclassmembers class * { public <init>(android.content.​Context); }

但我得到另一个classmembers错误。

But I get another classmembers errors.

推荐答案

感谢您了很多像这样的职位,有助于我们提前一步一步来。

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.