-3

I have activated usb debugging on my phone and hit "run" in Android Studio. The app runs fine on my phone. Now I want to have a clean stop of the connection instead of just pulling out the usb cable. I want Android Studio to tidy up everything, not leave any data of the app that I've just tested on the phone. How do I do that? That part is not described in the tutorial.

E_net4
  • 27,810
  • 13
  • 101
  • 139
Robert
  • 432
  • 1
  • 4
  • 15
  • Android studio doesn't do this. You'll have to do it yourself by uninstalling the app if you want this. – Gabe Sechan Jan 17 '19 at 21:19
  • Thanks, I thought in order to really install an app on a phone you have to build an apk first. – Robert Jan 17 '19 at 21:22
  • 1
    You do. It does that under the hood, then installs it using adb install. The only difference between that and the normal apk is that it will use your debug keystore, and the debug build configuration instead of release. – Gabe Sechan Jan 17 '19 at 21:22
  • Where can I get more information? Is this knowledge part of the documentation somewhere? – Robert Jan 17 '19 at 21:31

1 Answers1

1

There's no way to do it when you click on "Stop", but the closest thing I can think of is to use adb uninstall [package name] from the integrated terminal. You'll probably have to make it a habit of doing this before you disconnect your device. Or you can probably write a script to run this command to make for less typing.

For more background information, Android Studio uses Gradle to build your *.apk. You can modify how your *.apk gets built by updating your apps build.gradle file. Documentation here: https://developer.android.com/studio/build/

After Android Studio executes your gradle.build file to build your *.apk file, it then calls adb to install the *.apk to your emulator or device. adb is a handy tool to use that does some useful things for debugging, installing, uninstalling, etc. Documentation here: https://developer.android.com/studio/command-line/adb

SharpMobileCode
  • 938
  • 5
  • 8