AndroidStudio tips and tricks from Android Dev Summit
The more time we spending developing the more efficient we need to be. Knowing tips, tricks and shortcuts will help us develop much faster in the long run.
Recently on Android Dev Summit AndroidTools team make a huge step forward and gave an amazing talk and recap all the tricks we can use. I decided to put them down.
- Using TAB instead ENTER for autocompletion will provide completion without breaking syntax.
- CTRL-SHIFT-SPACEx2 smart autocompletion.
- Intention actions ALT-ENTER
- Live templates just start typing logd, sout, fori and hit ENTER
- One of my favourite ones after this talk become postfix autocompletion. Basically, get a list of methods from variables and at the bottom of the list, we will see live templates.
- Filter search works everywhere whenever we start typing
- Replace structurally details . Tip replace structurally legacy code and deprecated APIs.
- Add own inspection and turn into a quick fix. Continue watching point 7.
- Tools namespace for preview, ignored when building(e.g. listItem in GridView)
- Add shrinkResources to strip resources + use mode to tools:strictMode, tools:keep, tools:discard control it.
- CTRL+SHIFT+ALT to find any command + see shortcut
- Analyse stacktrace even obfuscated + see who committed it :)
- Condition on breakpoint if we know condition when we want to stop. Log expression on break point.
- Finally Enable all artefacts in AndroidStudio 2.0 with benefits such as Refactoring, etc.
- ALT+SHIFT+T create a test class with unit tests in according to package and names.
- CTRL+N generate test method
This was most of the tricks I found very useful. Some of them dramatically improved development speed.
Couple of things I wanted also to mention adding own shortcuts might be very useful for such actions like:
- Git -> Resolve conflicts
- Git -> Compare with the same repository version
- Attach debugger
- Sync gradle files
And there is also very useful stats hidden in AndroidStudio in Help -> Productivity Guide. See what we used and may experiment with more. That’s it for today stay tuned and continue exploring this wonderful Android World :)
Andrii Rakhimov - Android Developer @ Uklon