April 1

Android Weather SDK and ProGuard

In the Android development world, everyone knows about ProGuard. What they think of it, however, depends on where and when they ran into it.


I mean, back in the 90’s anyone who knew anything about the WWF knew about Andre the Giant. But they weren’t always thrilled to see him – especially in the ring.

ProGuard is a great tool, as is evident by the fact that it is part of the Android ecosystem by default. Like most things, when it works with you, it’s awesome! If Andre is your tag team partner, you can tag out and relax with a smile on your face. But when you’re in the other corner, it’s good to know a few tricks in case you wind up underneath a giant problem.

In the next couple of paragraphs, we’re talking about what ProGuard is, what it does well, and why some people avoid it like an old school cage match.

And oh yeah, we cover how to make the AerisWeather Android Weather SDK and ProGuard play nice together too.

The next section is a brief overview of ProGuard. If you’re just looking for the short version, skip down to Using the AerisWeather Android Weather SDK and ProGuard.

ProGuard In a Nutshell

ProGuard is currently the most popular Java bytecode optimizer. Made by GuardSquare, it’s free, it’s part of the stock Android development package, and it works.

ProGuard in a Nutshell





Its purpose is to run through your code base looking for Java classes, shrinking and obfuscating them.

It does what?

Shrinking (in the software development world) means that it finds and pulls out unused classes and methods (fields and variables too).

Obfuscation (fancy word for “mangle”) is the part that renames the remaining bits with random (typically shorter, often single character) names.



So for anyone building an app they want to protect from prying debuggers, it makes perfect sense. However, for folks who actually want their clients to see how they do things, it can be a top-level bummer. Basically, the renaming can make it really difficult to debug an application built with a library using ProGuard.

AerisWeather Android Nopes ProGuard

The AerisWeather Android Weather SDK doesn’t use ProGuard. The intent of our toolkits and their libraries is to provide an easier path for using the AerisWeather API and our Weather Mapping Platform (AMP). Removing and renaming parts of the library doesn’t further that goal, so we said nope.


Unfortunately, that carries a caveat for our users who do choose to include our SDK and ProGuard in their apps.

Working with one of our clients recently reveals that troubleshooting an issue can be challenging when class names and variables are as helpful as diet water.

Using the AerisWeather Android Weather SDK and ProGuard

Now that we have the basics covered, let’s look at using SDK and ProGuard together in your weather application. The folks at ProGuard make it pretty easy, actually. The ProGuard configuration options allow us to prevent it from removing or renaming certain parts of our code. They do this with a couple of aptly-named options like -keep or -keepclassmembers.

These options are available to us via the ProGuard config file, which not so coincidentally is the topic of the very next section.

ProGuard Config Entries

To customize what ProGuard does with our classes, we can tweak the configuration file. In most cases, that will be a file named proguard-rules.pro. It’s typically located in the root or app folder of an Android project and it looks something like the following:

To prevent ProGuard from obfuscating certain classes, we just need to add those class names to the -keepclasses line and un-comment it.

The actual entry in the config file depends on which version of the Aeris Android SDK we’re using. A few years ago, we updated the package name of the Aeris Android SDK from com.hamweather.aeris to com.aerisweather.aeris.

So, if we’re using SDK version 1.2 or older, the statement for the Proguard config file would be:

And if we’re using SDK version 2.0 or newer, add the following line:

For the most part, that’s all we need to do. If we run into issues where Proguard has removed or renamed a class, variable, etc that are making our debugging life difficult, we can always come back and tweak the config file and rebuild.

Thanks for stopping by! For more info on ProGuard, you can visit their site at ProGuard. To get started with your next weather-infused Android project, check out our Aeris Android Weather Toolkit.

Not currently an AerisWeather user? (Why not!?) Check out our free developer trial and start using the Android Weather SDK today!


Android Weather SDK Documentation

GitHub Project Page

Weather API Documentation

Weather Mapping Documentation


Happy Coding!

The AerisWeather Android Team

Share this post:

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.