简体   繁体   English

Android Studio(Intellij Idea) - 运行/调试配置 - 记住要运行的设备

[英]Android Studio (Intellij Idea) - run/debug configuration - remembering which device to run on

I guess this is a bit of a longshot, but with Eclipse, if you were using an Android emulator which was not the included one (for example, VirtualBox), you could select it the first time you ran your program, and tick a checkbox saying "Use this device for future launches". 我想这有点过分了,但是对于Eclipse,如果您使用的是不是附带的Android模拟器(例如,VirtualBox),您可以在第一次运行程序时选择它,并勾选一个复选框说“使用此设备进行未来发布”。 But the same option does not exist in Android Studio (Intellij Idea), meaning you have to choose the emulator every time you want to run the program. 但Android Studio(Intellij Idea)中不存在相同的选项,这意味着每次要运行程序时都必须选择模拟器。

I'm wondering if anyone knows of any way I can hack this so it will always run on a particular emulator which is not the built-in emulator. 我想知道是否有人知道我可以破解它的任何方式因此它将始终运行在不是内置模拟器的特定模拟器上。 Can I put the emulator's ip address and port into a config file somewhere so the program will always launch on it without me having to click? 我可以将模拟器的IP地址和端口放到某个配置文件中,这样程序将始终在其上启动而无需单击吗? I know it's a small thing but it's just convenience. 我知道这是一件小事,但这只是方便。

Sure it does, click the dropdown next to the run config, and press "Edit Configurations" 确实如此,单击运行配置旁边的下拉列表,然后按“编辑配置”

运行C.

运行配置

You can then select an Emulator, A Device, or to ask you when you run the app (like you have now). 然后,您可以选择模拟器,设备或在运行应用程序时询问您(就像您现在一样)。

The correct answer is to select USB device as the default. 正确答案是选择USB设备作为默认设置。 The program will then automatically run on the connected Virtualbox emulator. 然后,程序将自动在连接的Virtualbox仿真器上运行。 The answer was provided by sasha_trn in this comment 答案由sasha_trn在本评论中提供

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

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