Proguard with OrmLite on Android
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.
How to use ProGuard with OrmLite in android
adding the below line solved my problem
-ignorewarnings
:D
Unable to get Ormlite working after using Proguard
For OrmLite I use this config:
-keepattributes *Annotation*,Signature
-dontnote com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper
-keepclassmembers class * extends com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper {
<init>(android.content.Context);
}
-dontnote com.j256.ormlite.field.DatabaseFieldConfig
-keepclassmembers class com.j256.ormlite.field.DatabaseFieldConfig {
<fields>;
}
-dontnote com.j256.ormlite.dao.Dao
-keepclassmembers class * implements com.j256.ormlite.dao.Dao {
<init>(**);
<init>(**, java.lang.Class);
}
-dontnote com.j256.ormlite.android.AndroidLog
-keep class com.j256.ormlite.android.AndroidLog {
<init>(java.lang.String);
}
-dontnote com.j256.ormlite.table.DatabaseTable
-keep @com.j256.ormlite.table.DatabaseTable class * {
void set*(***);
*** get*();
}
-dontnote com.j256.ormlite.field.DatabaseField
-keepclassmembers @interface com.j256.ormlite.field.DatabaseField {
<methods>;
}
-dontnote com.j256.ormlite.field.ForeignCollectionField
-keepclassmembers @interface com.j256.ormlite.field.ForeignCollectionField {
<methods>;
}
-keepclasseswithmembers class * {
@com.j256.ormlite.field.DatabaseField <fields>;
}
-keepclasseswithmembers class * {
@com.j256.ormlite.field.ForeignCollectionField <fields>;
}
-dontnote org.joda.time.DateTime
-keep,allowobfuscation class org.joda.time.DateTime
-keepclassmembers class org.joda.time.DateTime {
<init>(long);
long getMillis();
}
That should be all that's necessary.
crash using ORMLite on Android with proguard
The error message mentions generic parameters, so ORMLite is probably using reflection to retrieve generic type information. This information is stored in optional Signature attributes (Java erases generic types), which ProGuard removes by default. You can keep them with
-keepattributes Signature
Proguard with Ormlite no such column
Adding columnName to the DatabaseField annotation solved my problem.
@DatabaseField(columnName = "")
Related Topics
How to to Check If a User Has Rated Your App on the Google Play
How to Run a Service Every Day at Noon, and on Every Boot
Send Post Request with Params Using Retrofit
Android Studio: Duplicate Files Copied in APK Meta-Inf/Dependencies When Compile
Google Maps Fragment Returning Null Inside a Fragment
Android Studio 3.0 Manifest Error: Unknown Element <Action> Found
Google Maps API V2 'Failed to Load Map. Could Not Contact Google Servers'
No Adapter Attached; Skipping Layout
How to Record Screen and Take Screenshots, Using Android API
Detect If App Was Downloaded from Android Market
How to Check the Multiple Permission at Single Request in Android M
Error: Configuration with Name 'Default' Not Found in Android Studio
How to Hide Toolbar When I Scrolling Content Up
Image Share Intent Works for Gmail But Crashes Fb and Twitter
How to Write a Drawable Resource to a File
How to Access a File from Asset/Raw Directory
Can the Android Emulator Record and Play Back Audio Using Pc Hardware