nu everest
nu everest

Reputation: 10249

How do I uninstall and re-run an app on a device using Android Studio?

I am new to Android Studio and I feel that I must be doing something wrong. When running MyApp on an actual device the process goes like this.

This is repetitive and time consuming. Is there a way to uninstall MyApp via Android Studio?

If not is there some other more automated way to do this?

BTW I have seen this question How to automatically uninstall android app from device before installing a new version but it does not sufficiently address the issue.

Upvotes: 24

Views: 33592

Answers (5)

Dyno Cris
Dyno Cris

Reputation: 2414

You can make just like this now. Check mark on Clear app storage before deployment.

enter image description here

enter image description here

UPD: Unfortunately it need to make for all new projects each time. But solution works super good.

Upvotes: 5

Frank Yin
Frank Yin

Reputation: 1990

I think this answer is what you're looking for. Basically edit your configuration to perform an uninstall before app launch.

From the Run menu -> Edit Configurations... -> Before Launch -> Add Gradle-aware Make -> ":app:uninstallAll"

enter image description here

Upvotes: 96

TheDarkTron
TheDarkTron

Reputation: 324

You can execute the gradle task :app:uninstallAll to uninstall the app. The next time you hit Run your app will be reinstalled.

Android Studio Gradle Tab with selected uninstallAll task

Upvotes: 10

Kasper Agg
Kasper Agg

Reputation: 107

You can skip the force stop and uninstall step by just hitting run again. Android Studio should prompt you which device to run on and there you can select your connected device.

It will close the app and re-run your changed version.

Upvotes: 4

Kristy Welsh
Kristy Welsh

Reputation: 8530

I always just hit the "debug" icon (the bug icon) and from the debug tab (at the bottom of your screen), you can stop running the app by clicking on the stop button. No need to uninstall/reinstall app. When you're done, you can do a release build of the apk.

Upvotes: 2

Related Questions