问题描述
在emulator
上首次启动应用后,在Android studio 2.0
中,似乎附加了运行进程.但是,如果我连接设备并想测试应用程序,则不会显示设备选择器对话框.我尝试了即时运行,简单运行,检查过的配置(已设置为显示选择器对话框),但所有更改均已对emulator
应用进行了.
In Android studio 2.0
after first app launch on emulator
it seems that run process is attached to it. But if I connect device and want to test app, device chooser dialog is not showing up. I tried instant run, simple run, checked configurations (it's set to show chooser dialog), but all changes are made to emulator
app.
如何在不关闭emulator
且不丢失emulator
即时运行"**connection**
"的情况下在设备中启动应用程序?
How to launch app in device without turning off emulator
and losing instant run "**connection**
" with emulator
?
推荐答案
此行为显然是一个缺点,它将在后续版本中得到修复,其中有一个.
This behaviour is clearly a shortcoming that's going to be fixed in subsequent releases, there's an open issue at AOSP.
现在,我发现了两种不需要Studio重新启动或终止adb进程的变通方法:
Right now I found two workarounds that don't require studio restart or killing the adb process:
-
强制关闭正在进行即时运行会话的设备上的应用程序.这样,会话将关闭,并且在下次运行后将要求您选择设备.
Force close the app on the device you have the ongoing instant-run session. This way the session will be closed and you will be asked to choose the device after next run.
如果您之前按过运行"按钮,则按调试"按钮,反之亦然.由于某种原因,从运行更改为调试或从调试更改为运行会强制AS关闭即时运行会话.
Press the "debug" button if you've pressed the "run" button before and vice versa. For some reason, changing from run to debug or from debug to run forces AS to close the instant run session.
这篇关于即时运行后未显示设备选择器对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!