Tuesday, November 11, 2014

Using the Android Emulator

First try with android emulator -> too slow

When I first started Android development, I tried to use the emulator, but it was painfully slow. I figured that it was because my laptop was weak (ex: it only had 1 GB of RAM). Luckily, I had an Android phone, so I replaced the emulator with an actual device. Given my weak laptop, I could not be sure if the problem was me or the emulator.

Second try -> still not worth it

After some time, I bought a new laptop with a little more oomph (4 GB of RAM !!!!). The Android emulator performed a little bit better, but it still performed worse than just using a real device. Since the apps I was building did not vary much from one device to the next, this was just sufficient. At this point, I was close to giving up on developing with an emulator forever.

Third try is the charm

With the latest release of Android L, I really needed to use an emulator. The SDK had retired an API that I was using, and I had to depend on a new one. A factory image of the new version of Android was not available for any device I owned. An emulator was my only option, which I feared would bring my development output to a crawl.

Luckily, I found that changing two things really improved the performance of the emulator - from unusable to rather snappy.

  1. Install the Intel Hardware Acceleration Manager. This is available in the SDK Manager in Android Studio, but it did not seem to work for me. So, I manually installed it.
  2. The other thing I did was change the emulator setting to 'Use HOST GPU' and to set the ABI to 'x86' (to take advantage of the hardware acceleration).

With these changes, the emulator has been running really well.

Conclusion

If you are like me, and you have previously given up on the Android emulator, maybe now is a good time to give it a try again.

References

Changes in Android 5.0

Intel hardware accelerated execution manager

No comments:

Post a Comment