如何卸载APK(或执行ADB命令)运行或调试前自动? [英] How to uninstall APK (or execute adb command) automatically before Run or Debug?
问题描述
现在我需要运行/调试它在Android的工作室之前,每次卸载应用程序。因为我需要重新创建数据库之前,我跑\调试应用程序。我知道我可以运行在/数据/数据/ [程序包]命令亚行卸载[程序包]在终端以清除文件。但它不是方便的方式,如果我每次都执行该命令。我希望亚行卸载命令可以自动当我点击运行\调试按钮来执行。
- 在Android的Studio中,单击下拉列表,以运行按钮的左边,然后选择编辑配置...
- 点击下的Android应用程序,并在常规选项卡,找到标题推出前
- 单击+按钮,选择运行外部工具,点击弹出窗口中的+按钮。
- 在给予一定的名称(如亚行卸载)和描述,并在节目类型
亚洲开发银行
:和卸载<您-包名称>
的参数:。 确保新项目被选中当你在弹出的窗口中单击OK。
请注意:如果你没有ADB在PATH环境变量,给的完整路径亚洲开发银行计划:字段(例如/家庭/用户/安卓/ SDK /平台工具/ ADB)
Now I need to uninstall the App every time before Run/ Debug it in Android Studio. Because I need to re-create the database before I run \debug the app. I know I can run the command "adb uninstall [package_name]" in terminal to clear the files under /data/data/[package_name]. But it's not convenient way if I have to execute the command every time. I hope the "adb uninstall" command can be executed automatically when I click "Run" \ "Debug" button.
- In Android Studio, click the drop down list to the left of Run button, and select Edit configurations...
- Click on app under Android Application, and in General Tab, find the heading 'Before Launch'
- Click the + button, select Run external tool, click the + button in the popup window.
- Give some name (Eg adb uninstall) and description, and type
adb
in Program: anduninstall <your-package-name>
in Parameters:. Make sure that the new item is selected when you click Ok in the popup window.
Note: If you do not have adb in your PATH environment variable, give the full path to adb in Program: field (eg /home/user/android/sdk/platform-tools/adb).
这篇关于如何卸载APK(或执行ADB命令)运行或调试前自动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!