In this series we’ll see a few lesser known tips for improving your productivity in Android Studio and IntelliJ IDEA. These posts won’t be your everyday shortcut list posts; instead, I’ll try to show you how I use some neat IDE features to address issues I encounter in my daily Android development.
Clear the app data quickly
When developing an app, you’ll surely have encountered situations when you need to clean up the data directory. Common examples include: testing some onboarding flow, an upgrade of the database, and so on.
Unfortunately, the flow you’d instinctively go through is really tedious:
- Open up the multitasking menu
- Long-press the app entry
(on Lollipop+, do it on the icon in the task description; pre-Lollipop, tap “App info” in the popup menu that appears)
- Navigate to the storage section of the app details screen, if needed
- Tap Clear data
- Re-open the app
All these steps have to be repeated every. Single. Time. Arrrgh!
What if I told you there’s a better way of doing it?
Well as it turns out, there’s a really nifty little AS plugin created by fellow GDE Philippe Breault.
That plugin, called ADB IDEA, adds a few entries to the Tools > Android menu in Android Studio:
What we’re looking for here is the ADB Clear App Data and Restart entry. Select that, and the plugin will do all the tedious work for you with just a couple of clicks. It’s way faster and more convenient than doing it by hand on the device!
How do you install the plugin?
The easiest way is to follow the instructions on the plugin README:
One last protip
Make the whole procedure even faster by using the plugin’s own ADB Operations dialog. Invoke it with
Ctrl-Alt-Shift-A on Linux and Windows). You can then use the awesome partial match capabilities of the IDE to select the action. Just type
cr (shorthand for Clear Restart).
Or, if you want to save 50% of your keystrokes on the dialog, just use the number for the option you want to use — in this case,
Want to read more?
You can take a look at the other posts in this series.