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

查看:18
本文介绍了如何在安装新版本之前从设备上自动卸载 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.

选择你的,窗口右侧是配置的详细信息,该部分的底部是Before launch部分.

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天全站免登陆