1

Is this an existing gradle android task that uninstall the current app, rebuild, install and run it in one go, or do I need to define a custom task for this workflow?

user1615898
  • 1,185
  • 1
  • 10
  • 20

2 Answers2

0

Yes, off course. Whenever you initiate the execution, it is build & installed. For the second time, it executes the changes that are made, re-builds & installed. All of the them are carried away, by default.

Sandeep Roy
  • 417
  • 6
  • 27
0

Yes you can do it easily.

Apparently, if you in Run -> Edit Configurations..., on the left side there is a expendable list of Android configurations.

Select yours, on the right side of the window are details on the configuration, at the bottom of that section is the Before launch section.

Create a gradle-aware Make, given the task :app:uninstallAll or :app:uninstallDebug whichever suits you. (There is autocompletion to get all the available tasks, app may vary if you have several modules).

Read this articles:

How to automatically uninstall android app from device before installing a new version

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

Community
  • 1
  • 1
xxx
  • 3,315
  • 5
  • 21
  • 40