Difference Between iPhone Simulator and Android Emulator

Difference between iPhone Simulator and Android Emulator

Disclaimer: I'm only an iPhone developer, not an Android developer.

You are correct, the difference between emulators and simulators is that emulators mimic the software and hardware environments found on actual devices. Simulators, on the other hand, only mimic the software environment; they otherwise have access to all of the host system's hardware resources such as disk space, memory and processor speed.

Apple always harps on the importance of device testing because iPhone Simulator does not emulate an iPhone processor, disk drive, memory constraints and whatnot. You hardly ever get memory warnings unless your Mac is struggling to manage resources itself, unless you simulate (again) memory warnings from the Simulator's menu item.

In fact, if you go to Settings > General > About, you'll see that the Simulator's disk capacity is the same as the filesystem of the Mac it's installed on:

Why Android Emulator is Way Slower than iPhone Simulator?

It's a matter of architectural decisions:

  • iOS simulator runs native code, directly on your CPU - the project has to be recompiled for x86 architecture to be used with simulator. The simulator itself simply emulates all the iOS APIs.

  • Android emulator, on the other hand, uses QEMU to run ARM (or x86, but ARM is more popular) CPU virtual machine, with all the software stack on top of it - Linux kernel, Android system image, etc. Think of it as an emulated hardware.

It's a sort of trade off - the way iOS does it is much faster, but it is harder to make it 100% compatible with the target system. For Apple it was perhaps a bit simpler, as iOS and Mac OS have many things in common.

For Android it makes a lot of sense to emulate the whole stack - it is easier to build cross-platform SDK, easier to test some system level components with it, etc. It's simply a different ecosystem, with different goals. Don't forget, that Android emulator can be used e.g. to test native ARM libraries compiled with Android NDK.

Today the Android emulator performance is more or less acceptable, but it was just a disaster in the early Android days. That said, personally I think that fast, API-level native simulator for Android would be a great addition to the SDK, making it possible to test less demanding projects much faster.

Interesting reading: http://logic-explained.blogspot.com/2011/09/why-is-there-no-x86-native-emulator-for.html

What's the difference between real device and simulator/emulator?

Recently in QCon, Gerard Meszaros said that we should run automation tests only on simulators to improve efficiency.

This was odd advice, if that is really what Mr. Meszaros said. Running tests on the emulator is fine, but "only" is an excessive recommendation. There is no harm in running automated tests on devices, and you can learn a lot from doing so.

But I'm not sure if there will be some issues that can only found in a real device?

Of course.

  • Many devices have multi-core CPUs, whereas the emulator only emulates a single core at this time
  • Device storage tends to run a lot slower than does storage on the emulator
  • Device manufacturers tinker with Android in ways that will not appear on an emulator running stock Android
  • The emulator only loosely emulates hardware related to power, Internet (e.g., no mobile data, no WiFi), GPS, sensors, camera, etc.
  • The emulator does not support some device capabilities, like the new V2 version of Maps, the Play Store, multiple accounts on Android 4.2, etc.

And so on.

Or some components like camera, gravity sensors could not be tested in a simulator/emulator?

Those ones are difficult to test in an automated fashion, period.

Why is the iOS emulator far faster than Android's?

Because the iOS "emulator" is not an emulator... it's a simulator.

From this answer:

the difference between emulators and simulators is that emulators mimic the software and hardware environments found on actual devices. Simulators, on the other hand, only mimic the software environment; they otherwise have access to all of the host system's hardware resources such as disk space, memory and processor speed.

How to use both Android and IOS simulator simultaneously to test my flutter app during development?

Yes. If you have both iOs and Android emulators running, you can use the command flutter run -d all to launch on both devices. If you want to launch on one device with both open, you will have to specify which one by telling it the device id, like flutter run -d emulator-5554.

While developing I like to have the iOs emulator open for debugging in case I want to jump in and see the value of a particular variable at a particular moment, and the android emulator for running the app / designing / iterating.

Simulator or Emulator? What is the difference?

Emulation is the process of mimicking the outwardly observable behavior to match an existing target. The internal state of the emulation mechanism does not have to accurately reflect the internal state of the target which it is emulating.

Simulation, on the other hand, involves modeling the underlying state of the target. The end result of a good simulation is that the simulation model will emulate the target which it is simulating.

Ideally, you should be able to look into the simulation and observe properties that you would also see if you looked into the original target. In practice, there may some shortcuts to the simulation for performance reasons -- that is, some internal aspects of the simulation may actually be an emulation.

MAME is an arcade game emulator; Hyperterm is a (not very good) terminal emulator. There's no need to model the arcade machine or a terminal in detail to get the desired emulated behavior.

Flight Simulator is a simulator; SPICE is an electronics simulator. They model as much as possible every detail of the target to represent what the target does in reality.

EDIT: Other responses have pointed out that the goal of an emulation is to able to substitute for the object it is emulating. That's an important point. A simulation's focus is more on the modeling of the internal state of the target -- and the simulation does not necessarily lead to emulation. In particular, a simulation may run far slower than real-time. SPICE, for example, cannot substitute for an actual electronics circuit (even if assuming there was some kind of magical device that perfectly interfaces electrical circuits to a SPICE simulation.)
A simulation does not always lead to emulation --



Related Topics



Leave a reply



Submit