j256 / ormlite-android

ORMLite Android functionality used in conjunction with ormlite-core
http://ormlite.com/
ISC License
1.59k stars 367 forks source link

Proguard issues with id field #84

Open thalesbm opened 6 years ago

thalesbm commented 6 years ago

I am trying to use proguard but I am getting error with the ormlite

09-16 19:31:27.477 13462 13462 E AndroidRuntime: java.lang.RuntimeException: Unable to create application br.com.calculadora.v2.CalculadoraApplication: java.lang.IllegalArgumentException: Foreign field class br.com.calculadora.v2.e.a does not have id field

I am using these two dependencies:

    compile 'com.j256.ormlite:ormlite-core:4.48'
    compile 'com.j256.ormlite:ormlite-android:4.48'

and my proguard rules has ( I looked the issue #44 ):

-keepattributes *DatabaseField*
-keepattributes *DatabaseTable*
-keepattributes *SerializedName*
-keep class com.j256.**
-keepclassmembers class com.j256.** { *; }
-keep enum com.j256.**
-keepclassmembers enum com.j256.** { *; }
-keep interface com.j256.**
-keepclassmembers interface com.j256.** { *; }
-dontwarn com.j256.ormlite.android.**
-dontwarn com.j256.ormlite.logger.**
-dontwarn com.j256.ormlite.misc.**

Do you guys have any idea?

daberni commented 6 years ago

have you tried

-keepclassmembers class <your model package>.** {
    @com.j256.ormlite.field.DatabaseField <fields>;
    @com.j256.ormlite.field.ForeignCollectionField <fields>;
}