1

When I deploy/debug APK with android studio it always retains data by default. I want to make a new configuration that helps me install without data retention. Any ideas?

And no, I don't want to use gradle at command line everytime.

shadox
  • 3,128
  • 4
  • 23
  • 37

1 Answers1

2
adb shell pm clear <you.package.name>

Make sure you have adb in command line, otherwise you need to configure adb in your PATH, or go to the directory of your Android SDK.

Copied from my another question but changed the key command: stackoverflow.com/a/25927723/4932305

  1. In Android Studio, click the drop down list to the left of Run button, and select Edit configurations...
  2. Click on app under Android Application, and in General Tab, find the heading 'Before Launch'
  3. Click the + button, select Run external tool, click the + button in the popup window.
  4. Give some name (Eg adb uninstall) and description, and type adb in Program: and shell pm clear <you.package.name> in Parameters:. Make sure that the new item is selected when you click Ok in the popup window.
Jagger
  • 1,954
  • 2
  • 12
  • 11