⌛ This article is now 10 years and 10 months old, a quite long time during which techniques and tools might have evolved. Please contact us to get a fresh insight of our expertise!
Speed up your Android Emulator!
If you develop applications for iOS and Android, you probably have used the iPhone Simulator and the Android Emulator. There is no real issue with the iPhone simulator, but Google one is very, very, very slow. It is so painful to debug with it that if you develop on Appcelerator’s JavaScript-based Titanium SDK, you only use the iPhone Simulator every time, except when you want to test something specific on Android.
The Android Emulator is based on QEMU (the Quick EMUlator) which emulates an ARM processor on your computer which has a x86 processor. I surely don’t need to explain why emulate a processor by a software isn’t a very good idea if you want something reactive and usable. Furthermore, other hardware features are also emulated by the software. All those things combined plus the fact that smartphones have some very powerful chipsets lead to a very slow emulator.
Section intitulée ok-but-what-can-i-do-about-itOk, but what can I do about it?
First thing to do is to launch the Android SDK Manager, go to your Android SDK’s installation folder, and type:
$ ./tools/android
You can see that there is an “Intel x86 Atom System Image” available for Android 4.2.2, 4.1.2, 4.0.3 and 2.3.3. Select the versions you want to test and install them.
If you scroll at the bottom of this screen, you’ll see an “Extras” folder, expand it and select the “Intel x86 emulator accelerator (HAXM)” to download it. You have to install it. To do so, go to your Android SDK’s installation folder, then go to extras/intel/Hardware_Accelerated_Execution_Manager/
and execute IntelHAXM.dmg
.
Now that you have installed everything, you need to configure your devices, just use the “Tools” menu to launch Android Virtual Device Manager (AVD Manager). There’s a list with all your devices, just create a new one. If you select a target that has an x86 image (let’s try with Android 4.2.2), you should be able to switch the CPU/ABI to “Intel Atom (x86)”. This configuration with the HAXM driver, easily installed, will let you run a faster emulator. We can go further! Edit the device configuration and check the “Use GPU Host” in the “Emulation options” section, it will allow the emulator to use the computer GPU instead of emulating one.
Ok, our device is ready. Just test it.
$ ./tools/emulator -avd Test_for_fast_emulator -wipe-data -no-boot-anim -cpu-delay 0
$ ./platform-tools/adb install ../Test/build/android/bin/app.apk
YEAHYYY! It’s fast!
Section intitulée how-do-i-do-this-with-titanium-studioHow do I do this with Titanium Studio?
If you use Titanium Studio, you can configure the Android Emulator to use the x86 image too.
Click on ‘Run Configurations”, select the project you’re working on and then choose the version of Android you want to test with the label “x86”:
Launch the Emulator, it should be faster, but not as fast as the one we’ve created using the AVD Manager because we didn’t select the option to use the GPU host. Launch the AVD Manager, you’ll see a new device which use a x86 CPU. Edit it.
You can see an Hardware section, click on “New”, select the “GPU emulation” property, and then switch its value to “yes”, save, relaunch your emulator, and there it is, fast and usable!
Protips©: In the Hardware section, also add the “Keyboard support” property, and set its value to “yes”, save, and relaunch the emulator, you’ll be able to use your keyboard to fill some form, or whatever!
Section intitulée please-notePlease note…
Don’t forget… you have to test your application on several real devices to ensure that the app works properly on different screen sizes, or hardwares. Keep in mind that smartphones have less bandwidth, or less battery than your computer.
Commentaires et discussions
Alloy selective compilation, for an even faster Titanium development process
The typical development toolchain in a modern Titanium project involves many tools: Titanium itself; the Alloy framework; TiShadow, for faster development deployments/tests; one or several pre-processors (Coffeescript, Jade, STSS, ticons, etc.) and their Grunt bindings; Grunt and…
Configurez votre Android Emulator pour qu’il soit rapide !
Si vous développez pour iOS et Android, vous avez très certainement utilisé l’iPhone Simulator et l’Android Emulator. A première vue, il n’y a pas de problème frappant avec l’iPhone Simulator, alors que l’emulateur de l’OS de Google est lent… très lent… extremement lent ! Tellement…
Lire la suite de l’article Configurez votre Android Emulator pour qu’il soit rapide !
Nos articles sur le même sujet
Ces clients ont profité de notre expertise
Nous avons effectué la refonte de l’application mobile Mediapart à l’aide de la plateforme Appelerator Titanium et du Framework Alloy. Dialoguant avec les APIs REST développées par les équipes internes de Mediapart, cette application est disponible à la fois sur iOS et Android et permet d’accéder à toute la richesse du contenu du journal en quatres…
Dans le cadre d’une refonte complète de son architecture Web, Expertissim a sollicité l’expertise de JoliCode afin de tenir les délais et le niveau de qualité attendus. Le domaine métier d’Expertissim n’est pas trivial : les spécificités du marché de l’art apportent une logique métier bien particulière et un processus complexe. La plateforme propose…
En tant que joaillier 100 % numérique, l’équipe de Courbet Paris a souhaité se doter d’une plateforme eCommerce, capable d’offrir une expérience moderne qui revalorise l’acte d’achat de produits de joaillerie sur internet. JoliCode a accompagné leur équipe en développant une plateforme robuste, mais aussi évolutive, afin de répondre aux enjeux business…