Genymotion vs Android 模拟器
Android Genymotion

> 
> Android 模拟器是否改善到足以取代 Genymotion
> 
> 
> 


![](/data/attachment/album/201710/22/110139c2uu85s5dgusbdkc.jpg)


一直以来有关于选择 android 模拟器或者 Genymotion 的争论，我看到很多讨论最后以赞成 Genymotion 而告终。我根据我周围最常见的情况收集了一些数据，基于此，我将连同 Genymotion 全面评估 android 模拟器。


结论剧透：**配置正确时，Android 模拟器比 Genymotion 快。**


使用带 Google API 的 x86（32位）镜像、3GB RAM、四核CPU。



> 
> * 哈，很高兴我们知道了最终结果
> * 现在，让我们深入
> 
> 
> 


免责声明：我已经测试了我看到的一般情况，即运行测试。所有的基准测试都是在 2015 年中期的 MacBook Pro 上完成的。无论何时我提及 Genymotion 指的都是 Genymotion Desktop。他们还有其他产品，如 Genymotion on Cloud＆Genymotion on Demand，但这里没有考虑。我不是说 Genymotion 是不合适的，但运行测试比某些 Android 模拟器慢。


关于这个问题的一点背景，然后我们将转到具体内容上去。


*过去：我有一些基准测试，继续下去。*


很久以前，Android 模拟器是唯一的选择。但是它们太慢了，这是架构改变的原因。对于在 x86 机器上运行的 ARM 模拟器，你能期待什么？每个指令都必须从 ARM 转换为 x86 架构，这使得它的速度非常慢。


随之而来的是 Android 的 x86 镜像，随着它们摆脱了 ARM 到 x86 平台转化，速度更快了。现在，你可以在 x86 机器上运行 x86 Android 模拟器。



> 
> * *问题解决了！！！*
> * 没有！
> 
> 
> 


Android 模拟器仍然比人们想要的慢。随后出现了 Genymotion，这是一个在 virtual box 中运行的 Android 虚拟机。与在 qemu 上运行的普通老式 android 模拟器相比，它相当稳定和快速。


我们来看看今天的情况。


我在持续集成的基础设施上和我的开发机器上使用 Genymotion。我手头的任务是摆脱持续集成基础设施和开发机器上使用 Genymotion。



> 
> * 你问为什么？
> * 授权费钱。
> 
> 
> 


在快速看了一下以后，这似乎是一个愚蠢的举动，因为 Android 模拟器的速度很慢而且有 bug，它们看起来适得其反，但是当你深入的时候，你会发现 Android 模拟器是优越的。


我们的情况是对它们进行集成测试（主要是 espresso）。我们的应用程序中只有 1100 多个测试，Genymotion 需要大约 23 分钟才能运行所有测试。


在 Genymotion 中我们面临的另一些问题是：


* 有限的命令行工具（[GMTool](https://docs.genymotion.com/Content/04_Tools/GMTool/GMTool.htm)）。
* 由于内存问题，它们需要定期重新启动。这是一个手动任务，想象在配有许多机器的持续集成基础设施上进行这些会怎样。


**进入 Android 模拟器**


首先是尝试在它给你这么多的选择中设置一个，这会让你会觉得你在赛百味餐厅一样。最大的问题是 x86 或 x86\_64 以及是否有 Google API。


我用这些组合做了一些研究和基准测试，这是我们所想到的。


鼓声……



> 
> * 比赛的获胜者是带 Google API 的 x86
> * 但是如何胜利的？为什么？
> 
> 
> 


嗯，我会告诉你每一个问题。


x86\_64 比 x86 慢



> 
> * 你问慢多少。
> * 28.2% 多！！！
> 
> 
> 


使用 Google API 的模拟器更加稳定，没有它们容易崩溃。


这使我们得出结论：最好的是带 Google API 的x86。


在我们抛弃 Genymotion 开始使用模拟器之前。有下面几点重要的细节。


* 我使用的是带 Google API 的 Nexus 5 镜像。
* 我注意到，给模拟器较少的内存会造成了很多 Google API 崩溃。所以为模拟器设定了 3GB 的 RAM。
* 模拟器有四核。
* HAXM 安装在主机上。


**基准测试的时候到了**


![Genymotion and Android Emulator Espresso Benchmark](/data/attachment/album/201710/22/110217by598s9sp0s0519e.png)


![Linpack](/data/attachment/album/201710/22/110218kmkrgffoo07k8kfz.png)


![Geekbench 4](/data/attachment/album/201710/22/110218xd7bue7u8sy1bvtb.png)


从基准测试上你可以看到除了 Geekbench4，Android 模拟器都击败了 Genymotion，我感觉更像是virtual box 击败了 qemu。



> 
> 欢呼模拟器之王
> 
> 
> 


我们现在有更快的测试执行时间、更好的命令行工具。最新的 [Android 模拟器](https://developer.android.com/studio/releases/emulator.html)创下的新的记录。更快的启动时间之类。


Goolgle 一直努力让



> 
> Android 模拟器变得更好
> 
> 
> 


如果你没有在使用 Android 模拟器。我建议你重新试下，可以节省一些钱。


我尝试的另一个但是没有成功的方案是在 AWS 上运行 [Android-x86](http://www.android-x86.org/) 镜像。我能够在 vSphere ESXi Hypervisor 中运行它，但不能在 AWS 或任何其他云平台上运行它。如果有人知道原因，请在下面评论。


PS：[VMWare 现在可以在 AWS 上使用](https://aws.amazon.com/vmware/)，在 AWS 上使用 [Android-x86](http://www.android-x86.org/) 毕竟是有可能的。




---


作者简介：


嗨，我的名字是 Sumit Gupta。我是来自印度古尔冈的软件/应用/网页开发人员。我做这个是因为我喜欢技术，并且一直迷恋它。我已经工作了 3 年以上，但我还是有很多要学习。他们不是说如果你有知识，让别人点亮他们的蜡烛。


当在编译时，我阅读很多文章，或者听音乐。


如果你想联系，下面是我的社交信息和 [email](thesumitgupta@outlook.com)。




---


via: <https://www.plightofbyte.com/android/2017/09/03/genymotion-vs-android-emulator/>


作者：[Sumit Gupta](https://www.plightofbyte.com/about-me) 译者：[geekpi](https://github.com/geekpi) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
There has always been a debate about which android emulator to choose or to go with Genymotion. I’ve seen most of the discussion ending in favour of Genymotion.

I’ve gathered some data around the most common use case in my experience. Based on this I’ll be evaluating all the android emulators along with Genymotion.

**TL;DR: Android emulator is faster than Genymotion when configured right.
Use x86 (32 bit) image with Google APIs, 3GB ram, quad-core CPU.**

Pheww, glad we’re past that


Now, let’s dive deep

**Disclaimer**: I’ve tested my use case which to me looks the general use case i.e. running tests.
All benchmarks were done on a mid-2015 MacBook Pro.

Wherever I say Genymotion I mean **Genymotion Desktop**. They have other products like Genymotion on Cloud & Genymotion on Demand which are not being considered here.

I’m not saying Genymotion is inadequate. But it is slower when running tests compared to certain Android emulators.

A little background on the subject and then we’ll jump to the good stuff.

*Psst: I have some benchmarks down the line, stick around.*

Long ago Android emulator was the only way to go. But they were too slow to use, the reason being a **change of architecture**.

What can you expect out of an ARM emulator running on an x86 machine? Every instruction had to be converted from ARM to x86 architecture which makes it really slow.

Then came along the x86 images of Android which are way faster as they get rid of the ARM to x86 platform change.

Now you can run x86 Android emulator on an x86 machine.


Problem solved!!!

NO!

Android emulators were still slow from what people wanted.

Then came along Genymotion, which is just an Android VM running in a virtual box. But it is quite stable & fast compared to plain old android emulators which run on qemu.

Let’s jump to how the situation is today.

I’m using Genymotion in CI infrastructure and on my machine.
The task at hand was to **get rid of Genymotion** used in CI infrastructure and machine.

You ask why?


Licenses cost money. Duh…

At a quick glance it seems like a stupid move as Android emulators are slow and buggy. But when you get into the nitty-gritty of the situation, you’ll find Android emulator to be superior.

My use case is to run integration tests on them (mostly espresso), just over 1100 tests. Genymotion takes ~23 minutes to run all the tests.

A few other problems faced with Genymotion.

- Limited command line tools (
[GMTool](https://docs.genymotion.com/Content/04_Tools/GMTool/GMTool.htm)). - They needed a periodic restart because of memory issues. This was a manual task, imagine doing it on a CI infrastructure with lots of machines.

**Enter Android Emulator**

The first time you try to set-up one of these it gives you so many options that you’ll feel like you are in Subway restaurant.

The biggest question of all is x86 or x86_64 and with Google APIs or without them.

I did some research and benchmarking with these combinations and this is what we came up with.

Drum Roll…

The winner of the competition is

x86 with Google APIs

But how? why?

Well, I’ll tell you the problem with every one of them.

x86_64 is slower compared to x86

By how much you ask.


28.2%much !!!

Emulator with Google APIs is more stable, things tend to crash without them.

This brings us to the conclusion that the best one is **x86 with Google APIs**.

Before we pit our winning emulator against Genymotion. There are a few more details that are of great importance.

- I’ve used a Nexus 5 system image with Google APIs.
- I noticed that giving emulator less ram caused a lot of Google API crashes. So I’ve settled for 3GB of ram for an emulator.
- The emulator has a quad-core.
- Host machine has HAXM installed.

**Time for few benchmarks**

From the benchmarks, you can see that Android emulator beats Genymotion expect for in Geekbench4. This feels more of a virtual box beating qemu thing.

All hail the King of the Emulators


We are now having a faster test execution time, better command line tools.
Also with the latest [Android Emulator](https://developer.android.com/studio/releases/emulator.html), things have gone a notch up. Faster boot time and what not.

Google has been working very hard to

Make Android Emulator great again


If you haven’t been using android emulator for some time. I’d suggest you revisit and save some money.

One other solution which I was trying but couldn’t really get it to work was running an [Android-x86](http://www.android-x86.org) image on AWS.

I was able to run it on a vSphere ESXi Hypervisor but not on AWS or any other cloud platform. If someone knows anything about it do comment below.

PS: [VMWare is now available on AWS](https://aws.amazon.com/vmware/), [Android-x86](http://www.android-x86.org) on AWS might be possible after all.

What do you think about Genymotion desktop and Android emulator? Comment below.

Share this article if you like it.