如何安装新版本之前,自动卸载从设备的Android应用 [英] How to automatically uninstall android app from device before installing a new version
问题描述
我使用Android的工作室有摇篮的基础之上。我在设备上测试我的应用程序,然后让Android Studio和摇篮构建应用程序和设备上安装它。我怎么能告诉摇篮或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?
推荐答案
显然,如果在运行 - >编辑配置...
,左侧有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这个意识的生成
,接受任务:应用:uninstallAll
或 :应用:uninstallDebug
哪个适合你。 (有自动完成获得所有可用的任务,应用
如果你有几个模块可能会有所不同)。
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屋!