Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Publish an Android App Publishing on Google Play Removing Log Calls

What is minifyEnabled ?

Should minifyEnabled( within the build.gradle ) be set to true when preparing the release version of an app ?

2 Answers

Harry James
Harry James
14,780 Points

Hey Abhishek!

minify is an Android tool that will decrease the size of your application when you go to build it. It's extremely useful as it means smaller apk files! It detects any code or libraries that aren't being used and ignores them from your final apk.

The only "disadvantage" to using minify is that if a user experiences a crash and reports it to you, the code is obfuscated and just looks like jumble! I put disadvantage in quotes there because it does actually assist in preventing people from reverse engineering your app to find exploits/passwords/API keys. See this section of the ProGuard documentation for details on how to decode a stack trace (ProGuard got renamed to minify but it is still called ProGuard in the documentation).

One important note though! If you're using minify, be sure to save your decoding key for EVERY release. You can't expect every one of your users to be running the latest version of your app so if they get a crash, you want to be able to read all of the crash logs, for every version.

Your decode key is stored under the build/outs directory in a mapping.txt file. Be sure to save it in a safe place! Also, note that the mapping.txt file will be overwritten for every app release so give it a new name and I'd also recommend you store it elsewhere than the build/outs directory in case it gets wiped for some reason (Hopefully not but, best to be on the safe side!)


Hopefully this should help explain it to you but if there's still something you don't quite understand, give me a shout and I'd be happy to help out :)

Seth Kroger
Seth Kroger
56,414 Points

minifyEnabled is what they changed runProguard to in later versions of Android Studio. It should be set to whatever you would have set runProguard to.