Properly setup proguard for an Android project

When dealing with an Android project you want to use Proguard to minify, shrink and possibly even obfuscate the code. The gains from this are huge and many smart minds have put a lot of thought into Proguard. We encountered that the TUM Campus App shrinked from 20 Megabytes to just 9 Megabytes with all the optimization in place – huge savings if you deploy it to 10k+ clients!

Really if you are not using this in your project currently you must be insane!

Anyways if you rely on external Libraries like Retrofit (Which is totally awesome, use it!) then you need to add some proguard rules in order to tell it what not to remove from those libs because it is really required but maybe not directly used. Mostly that is some models which get serialized and you might encounter some warnings but those don’t really are not interesting to you as a lib user.

This repository has a great collection on proguard files for various libs. Use it, don’t reinvent the wheel!

Published by

Kordian Bruck

I'm a TUM Computer Science Alumni. Pizza enthusiast. Passionate for SRE, beautiful Code and Club Mate. Currently working as an SRE at Google. Opinions and statements in this blog post are my own.

Leave a Reply