How "good" is the Android Emulator?
As the title says, how "good" is the Android emulator?
I don't have an Android phone but would it be possible to develop purely using the emulator as the testing environment?
My initial questions about it:
- Is the emulator as responsive as a normal android phone (of course this depends on the exact phone but in general)?
- Is there a way to control the memory on the emulator?
- Has anyone had issues that have been flagged on the phone but not the emulator? or vice versa?
- What's your normal testing procedure to test on both throughout, or emulator recursively and phone at the end?
Any feedback would be appreciated.
Q: Is the emulator as responsive as a normal android phone (of course this depends on the exact phone but in general)? A: Absolutely not! The worst example is the 3D, which is, afaik, only software emulation.
Q: Is there a way to control the memory on the emulator? A: Please specify, the size of the SD-Card is configurable, the RAM/VM-Memory... I don't know.
Q: Has anyone had issues that have been flagged on the phone but not the emulator? or vice versa? A: Each device has his own customization. On the emulator you can only change the screen resolution, but caution: the size of your Emulator screen depends on the pixel density you set up. So what might look good on your big emulator could be too tiny on a real device. And don't forget, a finger is much bigger and not as accurate as a mouse cursor.
Q: What's your normal testing procedure to test on both throughout, or emulator recursively and phone at the end? A: Functionality is tested during the implementation mainly on a (fast) device, like a Nexus One. The real test after implementation will be on as many devices as possible. The UI, too (most differences there)
Since I have a device which is has the latest SDK, I prefer testing on the device. Thats not necessary for programming an app, but please: don't publish an app without at least one test round on a real device :)
- Yes, the emulator is very fast.
- Yes, you can set the RAM size of the target you wish to emulate.
- I'm sure someone has, but I haven't.
- I usually test on the emulator during development, then on my G1 when I'm ready for longer term testing. After that I test on the emulator when checking compatibility with 1.5, 2.0, and 2.1 targets.
See here for what options targets support. Note there is a GUI tool for setting these up as well.
To answer the general question about how "good" the emulator is you need to look at what the emulator is.
The emulator is a piece of software (qemu) that is able to run arm instructions on a developer machine using emulation. This means that the emulator will run an android platform similar to what is running on a physical device. This setup is better than using a simulator where the platform is compiled for the development machine and not for the target hardware. There is however a number of limitations such as
- peripheral support - a mobile platform includes a number of companion chips such as bluetooth, wlan, gps, radio access, graphics acceleration etc. All of these are interacting with the main CPU in ways that are not predictable and hard to simulate on the emulator. Some are supported in a limited way such as internet access while others are not supported at all such as bluetooth.
- performance - the emulator is not a real processor and may not use physical accelerators available on an actual device. It also uses the host machine hardware for a lot of things meaning that memory access and similar items behave differently compared with testing on an actual device.
The general rule is that if it is possible try to do as much testing as possible on a device to avoid surprises in the end. The emulator is good for things such as testing general functionality, initial testing to avoid obvious bugs and checking that layouts and UI look decent at different screen sizes. When it comes to any performance critical testing or behaviour when interacting with the outside world, such as network interaction, the emulator is not recommended. It may tell you that your application has serious issues but do not trust "good enough" on the emulator to be good enough for the real world.
I'm going to answer #3 only, because the other answers have been covered already.
There's definitely some issues that are only present on the emulator and not on the device itself. One big one is that airport mode simply doesn't work on the emulator; internet still works despite turning airport mode on.
Also, if you're just using a stock emulator, you can't access the market, which means that any way which your app may try to interact with it can't be tested via emulator.
I know there are some other smaller issues which I've run into between an actual device and the emulator. There are enough things such that I highly recommended you don't develop solely on an emulator.
With emulator only your testing will have more mock testing to cover:
There frameworks to plugin to simulate sensor/device movement, camera by using your webcam, etc.
- You need memory to use emulatord like AVD emulator, emulator is good for testing but sometimes it can crash without reason.
- Yes you can change this settings many times.
- Some time ago I cannot emulate accelometer, but right now I can.
- I prefer to test my app on real device. I prefer testing my app on real devices (if my frends cannot creash it and JUnit tests works then it shouldn't be a problem), but I test different screen size on emulators.