android studio - tips, tricks & little known features
TRANSCRIPT
Android StudioTIPS, TRICKS & LITTLE KNOWN FEATURES
Andraž Pajtler
Android Studio First release 2013, final release and Eclipse plugin deprication 2014
Based on IntelliJ IDE Android Studio 2.1 (IntelliJ 15) Android Studio 2.2 (IntelliJ 16)
~ 2000 useful plugins from community
Shortcuts Intelijj is build with mouseless development in mind.
Shortcuts Cheat Sheet Mac Win/Linux
Mouseless Driven Development by Hadi Harirs (Jetbrains)
Master shortcut Shift + Ctrl + A (Ctrl + A for Win/Linux)
Search for all actions and options
Find Search everywhere Double Shift
File search Cmd + Shift + O (Ctrl + Shift + O for Win/Linux)
Class search Cmd + O (Ctrl + O for Win/Linux)
You don’t need to be very precise when searching; it will try to find the best result for all characters you wrote
Add :line_number on end to jump directly to this line
Symbol search Alt + Cmd + O (Shift + Ctrl + Alt + N for Win/Linux )
Search for variables, method names, classes…
Filter package and class name with a dot
Find in path (Preview tab) First 100 results
Easily move through them and see where your search result is in a broader context
Method/variable initialization/usage
Jump between Method/variable initialization/usage with Cmd + Click (Ctrl+ Click for Win/Linux)
Quick definition See variable, method, class definition without navigating away
Alt + Space (Shift + Ctrl +I for Win/Linux)
Smart type completion Basic completion Ctrl + Space
Smart type completion Ctrl + Shift + Space
Replacing method Confirming code completion with Enter vs. Tab
Replacing method - Enter
Replacing method – Tab
Surround With Cmd + Alt + T (Ctrl + Alt + T for Win/Linux)
Easy to surround a code block with if, while, for and other statements
Generate Cmd + N (Ctrl + N for Win/Linux)
Generate constructors, getters and setters, override methods…
ButterKnife plugin ButterKnifeZelezny
One-click creation of Butterknife view injections
Generate on layout reference (eg. R.layout.layout_name)
Live Templates Insert frequently-used or custom code constructs
Check included templates and create your own
Postfix code completion Cmd + J (Ctrl + J for Win/Linux) for listing all postfix code completion
Quick fix Alt + Enter
Typo fixes, changing method signature, adding imports,…
Performance tips #perfmatters
Exclude from auto-import Fragment, Handler, Date, …
Productivity Guide Help menu -> Productivity Guide
Useful productivity tips and counter how often are you using them
Toggle Case Toggle case with Shift + Cmd + U (Shift + Ctrl+ U for Win/Linux)
CamelCase plugin Shift + Alt + U Toggle between CamelCase, camelCase, snake_case and SNAKE_CASE
Multi cursor Add multiple cursors with Alt + Shift
Column Selection Mode Select code with middle mouse button pressed or enable in right mouse menu
Code selection and move Extend selection Cmd + ↑ (Ctrl + W for Win/Linux)
Shrink selection Cmd + ↓ (Shift + Ctrl + W for Win/Linux)
Move line Shift + Alt + ↑/↓
Move statement Cmd + Alt + ↑/↓ (Ctrl + Alt + ↑/↓ for Win/Linux )
Clipboard history Android Studio has it’s own clipboard history
Shift + Cmd + V (Shift + Ctrl + V for Win/Linux)
What does this button do?
Be like Dee Dee
Answer: Attach debugger Because the is icon bad it’s often overlooked Debugger can be attached to debuggable app at anytime
Scroll to file Useful for unordered drawables and layouts
Screen capture / record Directly from Android Studio
If Screen record button grey and un-clickable, device not supports video capture.
Run on multiple devices You can select multiple devices (Cmd/Ctrl + Click)
Doesn’t work with debug
Debugger – Thread and call stack Check if breakpoint stopped on UI or worker thread
Check other threads
Move back in call stack
Debugger – Custom object description Customize object debug description
Create custom object description
Create custom object description
Clean up after old versions (MacOS)
~/.AndroidStudioX.X
~/Library/Application Support/AndroidStudioX.X
~/Library/Caches/AndroidStudioX.X
Questions?