如何在Android中使用ProGuard和OrmLite

时间:2014-08-05 12:30:28

标签: android obfuscation proguard ormlite

我在Android项目中使用OrmLite 4.48。 我将这些行添加到我的proguard.cfg文件中:

-dontnote
-libraryjars libs/ormlite-android-4.48.jar
-libraryjars libs/ormlite-core-4.48.jar


-keepattributes Signature
-keep class ir.hnfadak.simineh.database.** { *; }

-keep class com.j256.**
-keepclassmembers class com.j256.** { *; }
-keep enum com.j256.**
-keepclassmembers enum com.j256.** { *; }
-keep interface com.j256.**
-keepclassmembers interface com.j256.** { *; }

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

-keepattributes *Annotation*

但是当我想要签名APK时,我收到了这些警告:

  

ProGuard:[Simineh]警告:   com.j256.ormlite.android.compat.JellyBeanApiCompatibility:找不到   引用的方法'android.database.Cursor   rawQuery(java.lang.String中,java.lang.String中[],android.os.CancellationSignal)”   在类android.database.sqlite.SQLiteDatabase中   ProGuard:[Simineh]警告:   com.j256.ormlite.android.compat.JellyBeanApiCompatibility $ JellyBeanCancellationHook:   找不到引用类android.os.CancellationSignal

有人能帮助我吗?

1 个答案:

答案 0 :(得分:2)

添加以下行解决了我的问题

-ignorewarnings

:d