5

我的应用程序在没有 proguard 的情况下完美运行。当我将 proguard 与 ormlite 一起使用时,我遇到了一些问题。在 logcat 中出现:

java.sql.SQLException: Field class for 'name' must be a parameterized Collection

在proguard文件中我放了:

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

你可以帮帮我吗?谢谢

4

1 回答 1

12

我发现您需要保留的不仅仅是Annotation属性

-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,*Annotation*,EnclosingMethod 

下面是我默认的 ormlite proguard 语句。您还需要保留描述数据的文件

# OrmLite uses reflection
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,*Annotation*,EnclosingMethod 
-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 class com.mycompany.myproduct.data.entity.**
-keepclassmembers class com.mycompany.myproduct.data.entity.** { *; }
-keep enum com.mycompany.myproduct.data.entity.**
-keepclassmembers enum com.mycompany.myproduct.data.entity.** { *; }
-keep interface com.mycompany.myproduct.data.entity.**
-keepclassmembers interface com.mycompany.myproduct.data.entity.** { *; }
于 2012-10-18T22:19:03.497 回答