問題描述
我正在使用帶有 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 應用的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!