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:
- in android studio, click drop down list left of run button, , select edit configurations...
- click on app under android application, , in general tab, find heading 'before launch'
- click + button, select run external tool, click + button in popup window.
- 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
Post a Comment