如何在安装新版本之前从设备上自动卸载 android 应用程序 [英] How to automatically uninstall android app from device before installing a new version

查看:31
本文介绍了如何在安装新版本之前从设备上自动卸载 android 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有 Gradle 构建的 Android Studio.我在设备上测试我的应用程序,让 Android Studio 和 Gradle 构建应用程序并将其安装在设备上.在安装新版本之前,如何告诉 Gradle 或 Android Studio 从设备上卸载应用程序?

I am using Android studio with Gradle builds. I test my app on a device and let Android Studio and Gradle build the app and install it on the device. How can I tell Gradle or Android Studio to uninstall the app from the device before installing a new version?

推荐答案

显然,如果你在 Run ->编辑配置...,在左侧有一个 Android 配置的消耗性列表.

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.

创建一个 gradle-aware Make,给定任务 :app:uninstallAll:app:uninstallDebug 哪个适合你.(有自动完成以获取所有可用任务,如果您有多个模块,app 可能会有所不同).

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).

这篇关于如何在安装新版本之前从设备上自动卸载 android 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆