Skip to content

Instantly share code, notes, and snippets.

@adam-lynch
Created October 31, 2013 11:11
Show Gist options
  • Save adam-lynch/7247983 to your computer and use it in GitHub Desktop.
Save adam-lynch/7247983 to your computer and use it in GitHub Desktop.
Speeding up the Google Android emulator (for Titanium)

Speeding up the Google Android emulator (for Titanium)

Using Android 4.2.2 as an example.


1. Get the x86 Image

  1. Run the Android SDK Manager.
    • Windows: <root Android directory>/SDK Manager.exe
    • Mac:
      • cd <root Android directory>/tools
      • ./android &
  2. You're better off just installing all packages, but make sure you definitely install everything under Android 4.2.2 (API 17), including the Intel x86 Atom system image.

2. Install HAXM

  1. Under Extras in the Android SDK manager, install the Intel x86 Emulator Accelerator (HAXM) package.

  2. Run the HAXM installer

    • Windows: <root Android directory>/extras/intel/Hardware_Accelerator_Execution_Manager/InstallHAXM.exe
    • Mac: <root Android directory>/extras/intel/Hardware_Accelerator_Execution_Manager/InstallHAXM.dmg
  3. Select a large amount of memory to give to HAXM. If you want to change this later just run the installer again.

  4. Windows: Intel VT-x, a dependency, is probably disabled. See Troubleshooting HAXM section in Notes at the bottom.

To be sure HAXM is installed properly, see the Troubleshooting HAXM section in Notes at the bottom.


3. Create an AVD

(via Titanium Studio)

  1. Run the Android AVD Manager
    • Windows: <root Android directory>/AVD Manager.exe
    • Mac:
      • cd <root Android directory>/tools
      • ./android avd &
  2. Delete any AVDs running Android 4.2.2
  3. In Titantium Studio, open Run Configurations (under Run).
  4. Select Titanium Android Emulator in the sidebar and click the New icon.
  5. Select Android 4.2.2 [x86] under Android API.
  6. Select WVGA854 under Screen.
  7. Click Apply.
  8. Click Run. The Android emulator should start.
  9. Close the emulator.
  10. Notice a new AVD in the Android AVD Manager. It should have "titanium" in the title and the Target name should be Android 4.2.2.

4. Configure the AVD

  1. Select the new AVD created by Titanium and click Edit....
  2. Under Skin, enter 320 x 528 for the Resolution.
  3. Under Hardware, enter the following:
    • SD Card support: yes
    • Hardware Back/Home keys: no
    • Abstracted LCD density: 160
    • Keyboard support: yes
    • Device ram size: as much as you can use without breaking it (there are platform-specific limits). Start with 500 anyway.

Choose one of the following:

  • Configuring the AVD for responsiveness

    1. Under Hardware, also enter the following:
      • GPU emulation: yes
    2. Make sure Snapshot is disabled.
    3. Save your changes to the AVD (make sure the cursor isn't in one of the hardware fields or else that field won't be saved).
  • Configuaring the AVD to start/open as quickly as possible

    1. Under Hardware, also enter the following:
      • GPU emulation: no
    2. Make sure Snapshot is enabled.
    3. Save your changes to the AVD (make sure the cursor isn't in one of the hardware fields or else that field won't be saved).
    4. Select the AVD, click Start....
    5. Tick Save to snapshot.
    6. Click Launch. The emulator will start.
    7. Wait until you at least see the Android homescreen, then close the emulator.
    8. Select the AVD, click Start....
    9. Tick Launch from snapshot.
    10. Click Launch. The emulator will start.
    11. Wait until you at least see the Android homescreen, then close the emulator.

Done!


Notes

Troubeshooting running AVD from Tianium

"…emulator exited with code 1"

Make sure you're running the AVD you originally created and configured.

  • Edit the AVD from the AVD Manager
  • Disable Snapshot
  • Run the AVD within Titanium. The emulator should open.
  • Wait until you at least see the Android homescreen, then close the emulator
  • Edit the AVD from the AVD Manager
  • Enable Snapshot
  • Run the AVD within Titanium. The emulator should open.

Troubleshooting HAXM

From the Android AVD Manager, select the new AVD created by Titanium and click Start. you should see "HAX is working and emulator runs in fast virt mode".

"Unable to load VM from snapshot"

If you see something along the lines of "snapshot not found" then re-do the "Configuaring the AVD to start/open as quickly as possible" step above, unless you did the "Configuring the AVD for responsiveness" step then edit the AVD and disable Snapshot.

"Intel VT-x not enabled"

You'll need to enable Intel VT-x in your BIOS settings (probably under processor settings). See Installation Instructions for Intel® Hardware Accelerated Execution Manager - Microsoft Windows*.

Other

Otherwise, you probably haven't set the correct settings in your BIOS settings and or the cause of the problem should be shown instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment