1
我正在使用ormlite 4.24。使用Proguard後無法使Ormlite工作
建設使用一個發佈版本後shrinkResources true
minifyEnabled true
我的應用程序失敗,出現以下錯誤:
"java.lang.RuntimeException: java.sql.SQLException: SQL statement failed: CREATE TABLE `ac` (`A` VARCHAR , `B` VARCHAR , `C` VARCHAR..."
嘗試選項,如後:
# 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.** { *; }
我仍然無法使用釋放建立。
我試過使用Ormlite版本。 5包括附加設置,如:
# 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.** { *; }
# Keep the helper class and its constructor
-keep class * extends com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper
-keepclassmembers class * extends com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper {
public <init>(android.content.Context);
}
# keep the classes and members of our entities or OrmLite will not work
-keep class com.myApp.activity.**
-keepclassmembers class com.myApp.activity.** {*;}
# Keep the annotations
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,*Annotation*,EnclosingMethod
-libraryjars <java.home>/lib/rt.jar
# Keep all model classes that are used by OrmLite
# Also keep their field names and the constructor
-keep @com.j256.ormlite.table.DatabaseTable class * {
@com.j256.ormlite.field.DatabaseField <fields>;
@com.j256.ormlite.field.ForeignCollectionField <fields>;
# Add the ormlite field annotations that your model uses here
<init>();
}
-keepattributes Signature
-keep class com.myApp.activity.database.** { *; }
-keepclassmembers class classpath.** {
public *;
}
-dontwarn org.slf4j.**
-dontwarn org.apache.log4j.**
-dontwarn org.apache.commons.logging.**
-dontwarn org.apache.commons.codec.binary.**
-dontwarn javax.persistence.**
-dontwarn javax.lang.**
-dontwarn javax.annotation.**
-dontwarn javax.tools.**
但我仍然無法運行我的應用程序。目前,我得到以下錯誤:
"java.lang.IllegalArgumentException: No fields have a DatabaseField annotation in class com.myApp.bean.p"