运行'uninstallAll'gradle任务,然后从build.gradle在Android Studio中运行应用程序

时间:2021-09-25 20:52:09

Before running my application I would like to uninstall any instances on the device. Running the task uninstallAll manually does this perfectly.

在运行我的应用程序之前,我想卸载设备上的任何实例。手动运行任务uninstallAll可以完美地完成此任务。

How can I call this command from my build.gradle so that this occurs each time automatically?

如何从build.gradle调用此命令,以便每次都自动执行此操作?

1 个解决方案

#1


What you may need is to set defaultTasks:

您可能需要设置defaultTasks:

defaultTasks uninstallAll

or specify appropriate tasks dependencies:

或指定适当的任务依赖项:

runTaskName.dependsOn(uninstallAll)

#1


What you may need is to set defaultTasks:

您可能需要设置defaultTasks:

defaultTasks uninstallAll

or specify appropriate tasks dependencies:

或指定适当的任务依赖项:

runTaskName.dependsOn(uninstallAll)