[英]Can I connect my physical laptop's usb port with cloud machine? I want to test android apps using android studio
I am using android studio on cloud, and I want to run android emulator but vt-x is disabled by the provider.我在云上使用 android 工作室,我想运行 android 模拟器,但 vt-x 已被提供商禁用。 So now is there any way to run emulator?那么现在有什么方法可以运行模拟器吗? And can I connect my laptop's usb port with that cloud machine?我可以将笔记本电脑的 usb 端口与那台云机连接吗?
Yes, but none of them is easy.是的,但没有一个是容易的。
"on cloud" means that it runs on a virtual machine far, far away. “on cloud”意味着它运行在很远很远的虚拟机上。 Its host machine, by the provider, surely has vt-x, because all recent strong hardware has.它的主机,由供应商提供,肯定有 vt-x,因为所有最近的强大硬件都有。 But currently it is impossible to emulate a virtual vt-x for a virtual machine, at least for productive environments.但是目前不可能为虚拟机模拟虚拟 vt-x,至少对于生产环境来说是这样。 This is why you have no access to vt-x on the virtual machine.这就是您无法访问虚拟机上的 vt-x 的原因。
Your options:您的选择:
There are various ways to transfer usb over network.有多种方法可以通过网络传输 usb。 Linux can do that quite easily, but you need Linux both on your cloud VM and on your laptop. Linux 可以很容易地做到这一点,但您的云虚拟机和笔记本电脑上都需要 Linux。 There are also various software solutions for windows. windows还有各种软件解决方案。 The problem with these is the delay.这些问题是延迟。 Some USB protocols have strict timing requirements and if your network is slow, the virtual machine might interpret it as faulty hardware.一些 USB 协议有严格的时序要求,如果您的网络很慢,虚拟机可能会将其解释为有故障的硬件。
The Android emulator is a modified Qemu . Android 仿真器是经过修改的Qemu 。 Android VMs can run even in an unmodified qemu. Android VM 甚至可以在未修改的 qemu 中运行。 It will be slow, and hard to finetune, afaik aosp does not even run in it, but lineageos yes (a link: https://android-x86.org ).它会很慢,而且很难微调,afaik aosp 甚至不能在其中运行,但是 lineageos 是的(链接: https://android-x86.org )。 As you have likely no kvm (linux kernel virtualization accelerator), but it would work.因为您可能没有 kvm(linux kernel 虚拟化加速器),但它会工作。
In your case I would try (1), if it does not work, then you need an essentially different solution.在你的情况下,我会尝试(1),如果它不起作用,那么你需要一个本质上不同的解决方案。 For example, you can script the Android Studio to deploy the compiled apk into your phone with network-based adb
.例如,您可以编写 Android Studio 脚本,以使用基于网络的adb
将编译后的 apk 部署到您的手机中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.