Android ProGuard issues with Google API libraries

This will be a short post. So, I have working with the Google API java library for Android and time has come to package the app for release and boom! ProGuard problems! First I had an issue with MinMaxPriorityQueue. When I tried to “Export Signed Application Package”, ProGuard would fail with a warning about this class. To get past this, you need to tell ProGuard not to warn you about it. Add this to your proguard.cfg:


Next, I had a problem with the JSON response from the API. It would complain about how there isn’t a publicly available constructor in a package (ex: or something like that). Your error may not be the same but it is more or less the same problem as mine (or anyone else using Google API libraries for Android). So you need to tell ProGuard to keep certain API classes from obfuscation:

-keep class<full package name of whatever library you are using>

I suggest also adding any other package (or individual classes) that you have declared in your application that is designated as a model for API responses. One last thing to note is, if your ProGuard config file doesn’t already have it, you should also add this:

-keepclassmembers class * { <fields>;

This would have already been added for you if you used the “android update project -p <your project>” in your command line (or Terminal) or if you have been using the latest Android tools.

16 thoughts on “Android ProGuard issues with Google API libraries

  1. I have added the -keepclassmembers class * { ;
    but still not working when i change the location in my application.


  2. Can you email me the errors? Your statement is too generic for me to tell you what might be wrong with your proguard setup. Actually stating what errors you receive will help me help you.


    1. Paste your full proguard config, the actual error stack trace. That way I can see what is wrong and what is missing in your proguard config to recommend adding something to it.


  3. No i haven’t found any exception or problem while exporting a release build.did u find problem in the code ?.which i sent to u.


  4. it is showing “Caused by: java.lang.InstantiationException:”$Geometry


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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