Android Studio : How to uninstall APK (or execute adb command) automatically before Run or Debug? -


now need uninstall app every time before run/ debug in android studio. because need re-create database before run \debug app. know can run command "adb uninstall [package_name]" in terminal clear files under /data/data/[package_name]. it's not convenient way if have execute command every time. hope "adb uninstall" command can executed automatically when click "run" \ "debug" button.

adb uninstall <package_name> 

can used uninstall app via pc. if want happen automatically every time launch app via android studio, can this:

  1. in android studio, click drop down list left of run button, , select edit configurations...
  2. click on app under android application, , in general tab, find heading 'before launch'
  3. click + button, select run external tool, click + button in popup window.
  4. give name (eg adb uninstall) , description, , type adb in program: , uninstall <your-package-name> in parameters:. make sure new item selected when click ok in popup window.

note: if not have adb in path environment variable, give full path adb in program: field (eg /home/user/android/sdk/platform-tools/adb).


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -