Proguard with Ormlite on Android

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



Leave a reply



Submit