miken.mkndev
miken.mkndev

Reputation: 1961

Proguard with Reflection

I've got a question regarding Proguard. I'm pretty new to using it and was wondering conceptually what classes in your project should you keep via the Proguard config txt file?

As far as I can tell the only ones that really matter are classes in which reflection is used. Such as if you use Sugar ORM then any subclasses of SugarRecord should be kept. Same if you use OkHttp3 to convert a class to JSON.

I guess I am just wondering what other "gotchas" are there to look for?

Thanks!

Upvotes: 1

Views: 693

Answers (2)

Ryan
Ryan

Reputation: 1883

The other classes I specify to keep are Gson models, custom exceptions and some others listed at Crashlytics ProGuard as I use Crashlytics for error reporting.

Also, if you don't you should check annotations as proguard will remove them by default I believe.

Upvotes: 2

jblejder
jblejder

Reputation: 1493

Libs you use often have specified Proguard rules so copy it to your rules. You should keep classes where you use reflection. Where you specify class names or fields by string.

For example you should keep api models and their fields because they are serialized from e.g json. (If you use Gson you can use @SerializedName annotation)

Upvotes: 3

Related Questions