简体   繁体   English

Android Clean build Gradle任务

[英]Android clean build gradle task

这是现有的gradle android任务,可以一次性卸载当前应用,重建,安装和运行它,还是需要为此工作流程定义自定义任务?

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. 默认情况下,所有这些都被带走。

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. 显然,如果您在运行->编辑配置...中,则在左侧有一个消耗性的Android配置列表。

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. 给定适合您的任务:app:uninstallAll或:app:uninstallDebug,创建可识别gradle的Make。 (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应用

Android Studio : How to uninstall APK (or execute adb command) automatically before Run or Debug? Android Studio:如何在运行或调试之前自动卸载APK(或执行adb命令)?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM