in Android App Development, Android Studio

10 Tips and Tricks to Make the Best Use of Android Studio IDE

If you’ve been developing for Android, you are already using Android Studio (and in case you’re not, you need to stop being a stone-ager right now!). This IDE has no equal when it comes to functionality, speed, and tight integration with the Android platform. As such, you’d be condoned in thinking that you’ve arrived at the holy grail of development and further improvement is not possible. Surprise! Turns out that a whole new level of productivity and functionality can be unleashed if you’re willing to explore a little.

So without further ado, there are some tips and tricks for Android Studio that can make you smile, or at best, save you an entire day’s frustration.

#1 Magic security check

What are you doing for ensuring the security of your Android app? Not much? Well, no need to be ashamed! Security indeed is a trite and difficult territory to navigate. But there are tools to make it painless. Check out Devknox if you haven’t – a static analyzer that finds and fixes vulnerabilities within your code. And it’s as easy as following the standard IDE recommendations while coding!

#2 Quick feature search

So you’d like to refactor your code but don’t remember where in the highly detailed menu the option is hidden. Or perhaps you want to change the colors used for coding, but are again running around in circles (Appearance? Setting? Editors? Colors and Fonts?). Say hello to the mighty Ctrl+Shift+A (or Cmd+Shift+A for Mac users), which opens a fuzzy search box where you just need to type some of the letters of the feature name. Within a second your job is done.

#3 Reveal usage

Often you feel you’d pay to know where a certain variable, function or class is used in the code. Searching manually is just not possible and will take too much time anyway. Enter the handy Alt+F7 shortcut: once you enter a symbol name, it will allow you to jump to all the places where it was used, using the arrow keys only. Press Escape when you’re done.

#4 Keep the log on application crash

When your app crashes, the log becomes a goldmine of information. Except that on Android Studio, the logs in such cases are cleared automatically! How do you get out of this mess? Simply go to the Android Monitor panel and create a new filter configuration. Now the logs will stay and you’ll have more peaceful nights.

#5 Code without distractions

If you’re too much a detail-observer, the Android Studio interface can be overwhelming on your senses. If so, magic exists in the form of View → Enter Distraction Free Mode, in which the editor will go fullscreen and you’ll be able to focus on only code.

#6 Auto indent stuff

Pasted code from somewhere and now the very thought of hitting Tab for each line giving you nightmares? Simply press Ctrl+Alt+I and watch the IDE indent code exactly as you wanted.

#7 Follow a consistent code style

It’s a good practice to have a consistent code style. The only problem is we ourselves can forget what the code style was for, say, nested classes. Looking it up in the middle of coding is too much of a bother. Instead, go to Preferences → Code Style → Java and create your own style that the IDE can enforce. It’s also a good idea to follow the code standards of trusted names like Google.

#8 Get better with Git

If you don’t like messing around with the Git command line interface, a plugin like Git Flow Integration can save the say. Visually create branches and see diffs without hurting your brain and eyes!

#9 Count the methods

ADB imposes a 65k method count limit on your app. So, how many method calls does your app have already? A fantastic plugin by the name of Android Methods Count will lift the curtain.

#10 Convert strings to resources

Strings are best used as resources, but creating resources comes with a whole Code of Conduct of its own. Bypass the shenanigans with Alt+Enter, and simply enter a resource name to finish the process!

Does it look like there’s end to Android Studio customization? That’s right, and it’s so because of the enthusiastic community around it. Sure, not all tools are top-notch, but we think we owe it to the spirit of Open Source to keep experimenting: if we find a shining pearl, we keep it; and if we happen to break something, we report it.

“71% of Devs believe security is not addressed during the application development lifecycle.” – Security Innovation Europe

Take on the mammoth task of security made effortless. 

Try Devknox