使用proguard在Android上崩溃ORMLite

时间:2013-10-29 08:23:38

标签: android proguard ormlite

一切顺利,直到我进行。 这是我的proguard-project.txt

-keep class com.j256.**
-keepclassmembers class com.j256.** { *; }
-keep enum com.j256.**
-keepclassmembers enum com.j256.** { *; }
-keep interface com.j256.**
-keepclassmembers interface com.j256.** { *; }
-keep class com.liba.carpool.db.**
-keepclassmembers class com.liba.carpool.db.** { *; } 
-keepattributes Signature

这是logcat:

  

10-29 16:11:24.616:E / AndroidRuntime(12870):   java.lang.ExceptionInInitializerError 10-29 16:11:24.616:   E / AndroidRuntime(12870):at   com.j256.ormlite.db.SqliteAndroidDatabaseType.extractDatabaseTableConfig(未知   来源)10-29 16:11:24.616:E / AndroidRuntime(12870):at   com.j256.ormlite.dao.DaoManager.createDao(未知来源)10-29   16:11:24.616:E / AndroidRuntime(12870):at   com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper.getDao(未知   来源)10-29 16:11:24.616:E / AndroidRuntime(12870):at   com.liba.carpool.db.MappingRouteRepository。(未知来源)   10-29 16:11:24.616:E / AndroidRuntime(12870):at   com.liba.carpool.db.MyRouteRepository。(Unknown Source)10-29   16:11:24.616:E / AndroidRuntime(12870):at   com.liba.carpool.a.a.loadCarpools(Unknown Source)10-29 16:11:24.616:   E / AndroidRuntime(12870):at   com.liba.carpool.DemoApplication.onCreate(Unknown Source)10-29   16:11:24.616:E / AndroidRuntime(12870):at   android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:981)   10-29 16:11:24.616:E / AndroidRuntime(12870):at   android.app.ActivityThread.handleBindApplication(ActivityThread.java:4462)   10-29 16:11:24.616:E / AndroidRuntime(12870):at   android.app.ActivityThread.access $ 1300(ActivityThread.java:139)10-29   16:11:24.616:E / AndroidRuntime(12870):at   android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1305)   10-29 16:11:24.616:E / AndroidRuntime(12870):at   android.os.Handler.dispatchMessage(Handler.java:99)10-29   16:11:24.616:E / AndroidRuntime(12870):at   android.os.Looper.loop(Looper.java:154)10-29 16:11:24.616:   E / AndroidRuntime(12870):at   android.app.ActivityThread.main(ActivityThread.java:4945)10-29   16:11:24.616:E / AndroidRuntime(12870):at   java.lang.reflect.Method.invokeNative(Native Method)10-29   16:11:24.616:E / AndroidRuntime(12870):at   java.lang.reflect.Method.invoke(Method.java:511)10-29 16:11:24.616:   E / AndroidRuntime(12870):at   com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:784)   10-29 16:11:24.616:E / AndroidRuntime(12870):at   com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)10-29   16:11:24.616:E / AndroidRuntime(12870):at   dalvik.system.NativeStart.main(Native Method)10-29 16:11:24.616:   E / AndroidRuntime(12870):引起:java.lang.NullPointerException   10-29 16:11:24.616:E / AndroidRuntime(12870):at   java.lang.reflect.Proxy.getInvocationHandler(Proxy.java:263)10-29   16:11:24.616:E / AndroidRuntime(12870):at   com.j256.ormlite.android.DatabaseTableConfigUtil.lookupClasses(未知   来源)10-29 16:11:24.616:E / AndroidRuntime(12870):at   com.j256.ormlite.android.DatabaseTableConfigUtil。(未知   源)

每个人都遇到同样的问题,谢谢

2 个答案:

答案 0 :(得分:0)

我遇到了和你一样的问题。我的解决方案是添加-keepattributes *Annotation*,它有效。 希望可以帮助你:)

答案 1 :(得分:0)

我将这些行添加到我的proguard规则中:

-keep class com.j256.**
-keepclassmembers class com.j256.** { *; }
-keep enum com.j256.**
-keepclassmembers enum com.j256.** { *; }
-keep interface com.j256.**
-keepclassmembers interface com.j256.** { *; }
-keepattributes Signature
-keepattributes *Annotation*
-keepclassmembers class * { public <init>(android.content.Context); }