I have an app that uses ActiveAndroid, a database ORM library, that relies on annotations.
@Table(name="test") public class DatabaseItem extends ActiveRecordBase<DatabaseItem> { public DatabaseItem(Context context) { super(context); // TODO Auto-generated constructor stub } @Column(name="counter") public int counter; }
How do I get Proguard working nicely with this? Currently, I get errors about not finding a column name by ActiveAndroid when using Proguard. I guess it somehow mangles the annotation.
My relevant Proguard configuration:
#ActiveAndroid -keep public class com.activeandroid.** -keep public class * extends com.activeandroid.ActiveRecordBase -keepattributes Column -keepattributes Table
What is ProGuard? ProGuard is a free java tool in Android, which helps us to do the following, Shrink(Minify) the code: Remove unused code in the project. Obfuscate the code: Rename the names of class, fields, etc. Optimize the code: Do things like inlining the functions.
-keepclassmembernames. This is the most permissive keep directive; it lets ProGuard do almost all of its work. Unused classes are removed, the remaining classes are renamed, unused members of those classes are removed, but then the remaining members keep their original names.
ProGuard Facts:Helps to remove unused classes, members & fields. It removes unused codes from your libraries as well. (Which means, any method or field that is not referenced anywhere will be removed by ProGuard Shrinker). Helps to reduce the build size by obfuscating the classes, methods, & fields with short names.
-dontwarn [class_filter] Specifies not to warn about unresolved references and other important problems at all. The optional filter is a regular expression; ProGuard doesn't print warnings about classes with matching names. Ignoring warnings can be dangerous.
Column
and Table
aren't existing java class file attributes. You'll at least have to specify
-keepattributes *Annotation*
Cfr. the ProGuard manual.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With