Android 模拟器基于 QEMU。我可以使用 KVM 吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2598942/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 06:30:18  来源:igfitidea点击:

Android emulator is based on QEMU. Can I use KVM with it?

androidandroid-emulatorqemu

提问by Felix

My laptop supports hardware virtualization (AMD SVM) and I know that:

我的笔记本电脑支持硬件虚拟化 (AMD SVM),我知道:

  • QEMU can make use of hardware virtualization through KVM;
  • The Android emulator is very much based on QEMU
  • QEMU 可以通过 KVM 来利用硬件虚拟化;
  • Android 模拟器很大程度上基于 QEMU

Natural question follows: can I combine the two (Android+KVM) to get improved performance in the emulator?

自然的问题是:我可以将两者结合起来(Android+KVM)来提高模拟器的性能吗?

采纳答案by David Evans

Yes, you can. Just download the appropriate Intel atom CPU packages in the Android SDK and have your AVD use an Intel atom CPU architecture. The android emulator can even use the host gpu. Here is a link on how to do it:

是的你可以。只需在 Android SDK 中下载合适的 Intel atom CPU 包,并让您的 AVD 使用 Intel atom CPU 架构。android模拟器甚至可以使用主机gpu。这是有关如何操作的链接:

http://developer.android.com/tools/devices/emulator.html#acceleration

http://developer.android.com/tools/devices/emulator.html#acceleration

回答by SaltySub2

You can try to use AndroidVM - http://androvm.org/blog/... In my testing you can have Hardware OpenGL and Rotation Support as well (this is slightly convoluted but everything is explained on the AndroidVM page).

您可以尝试使用 AndroidVM - http://androvm.org/blog/... 在我的测试中,您也可以拥有硬件 OpenGL 和旋转支持(这有点令人费解,但所有内容都在 AndroidVM 页面上进行了解释)。

In my experience this is miles better than the Android SDK Emulator, at least on Windows and Mac.

根据我的经验,这比 Android SDK Emulator 好很多,至少在 Windows 和 Mac 上是这样。

For Linux, you should be able to use VirtualBox for Linux to use AndroidVM. Since it is an OVA file mainly, you should be able to use other Virtualisation clients as needed.

对于 Linux,您应该能够使用 VirtualBox for Linux 来使用 AndroidVM。由于它主要是一个 OVA 文件,您应该可以根据需要使用其他虚拟化客户端。

What's interesting is that this is NOT emulating ARM, it is Android on x86... which has pros and cons, but definitely helps in not having to buy a ton of devices if you can do initial testing of various sorts on virtual machines, since Android 4.1 is generally not too heavily modified by manufacturers across ARM and x86 phones and tablets, etc (IMO).

有趣的是,这不是模拟 ARM,它是 x86 上的 Android……它有利有弊,但如果您可以在虚拟机上进行各种类型的初始测试,肯定有助于不必购买大量设备,因为ARM 和 x86 手机和平板电脑等 (IMO) 的制造商通常不会对 Android 4.1 进行过多的修改。

回答by dave1010

You can run Android-x86in QEMU with KVM (or even in VirtualBox). I'm not sure how easy it would be to set up for development but it should run quite a bit faster. Also, Intel are working ongetting Android on their x86 chips so this will hopefully become easier in the future.

您可以在 QEMU 中使用 KVM(甚至在 VirtualBox 中)运行Android-x86。我不确定为开发进行设置有多容易,但它应该运行得更快。此外,英特尔正在努力在其 x86 芯片上安装Android,因此这有望在未来变得更容易。

Update: I managed to get it working in VirtualBox, except some sites crash the web browser. Since I was making a web app, this was not helpful. It was much faster than the standard Android emulator though,

更新:我设法让它在 VirtualBox 中工作,除了某些站点使 Web 浏览器崩溃。由于我正在制作一个网络应用程序,这没有帮助。不过,它比标准的 Android 模拟器要快得多,

回答by Afriza N. Arief

Google TV emulator which is targeted at x86 supports KVM mode virtualization.

针对 x86 的 Google TV 模拟器支持 KVM 模式虚拟化

ARM is not there yet. I believe it's currently work-in-progress.

ARM 还没有出现。我相信它目前正在进行中。

回答by Pentium10

Not closely related to the answer you are after, but

与您所追求的答案没有密切关系,但是

  • use Runwhen you work on your interface, or as much as possible while coding (it's a lot faster compared to Debug, even 10 times faster)
  • try to minimize the Debugruns, learn to code perfect, so use less Debug.
  • probably you already know, you don't need to close the Emulator for each run session, so keep it open.
  • restart Eclipse after hour of usage, but keep the Emulator open. It's faster to restart Eclipse than the Emulator.
  • set Eclipse to remember the last run project, so the launch is done via just one click
  • Run在你的界面上工作时使用,或者在编码时尽可能多地使用(与 Debug 相比,它要快得多,甚至快 10 倍)
  • 尽量减少Debug运行次数,学习完美编码,因此少使用 Debug。
  • 您可能已经知道,您不需要为每个运行会话关闭模拟器,因此请保持打开状态。
  • 使用一小时后重新启动 Eclipse,但保持模拟器打开。重启 Eclipse 比重启模拟器更快。
  • 将 Eclipse 设置为记住上次运行的项目,因此只需单击一下即可启动