macos – Android emulator laggy on Mac-ThrowExceptions

Exception or error:

First of all, yes I know there’s a lot of topics similar to this issue, I did use the search function on stack overflow.

But most of the issue that were brought up seems to about long boot times.

For me, the emulator is so slow, simply sliding from one home screen to another is like watching a slideshow. I placed in more ‘RAM’ into the virtual device but nothing changes.

How do I fix this?

I’m using a Macbook Pro 2010 on Mac OS X Lion.

How to solve:

On the latest version of the Android SDK there is support for x86 and native execution. Now it is possible to run the emulator at native speeds on a Mac but there is some work to do by hand.

First you need the latest SDK Tools rev.19+ and Platform tools rev.11+, the Android x86 Atom System Image for 4.0.3 to 4.4 and the Intel Hardware Accelerated Execution Manager (HAX) all this from the Android SDK Manager.

After this you need to install HAX, unfortunately the SDK Manager downloads an outdated version. There is the Intel-HAXM hotfix v1.0.8

When you create a new AVD to use this latest system image and enable the GPU support on it (at the moment the snapshot support are not compatible with GPU but it still worths it. The VM will boot up in just a few seconds anyway.

It considerably accelerates the development on Android, it is just a shame that it doesn’t works like this out of the box.

###

The bounty is still open incase anyone comes up with something better.

But so far, the only solution I’ve found for testing android on Mac OSX is to use a VM. You can still build/install your app from Eclipse as normal using ADT/abd

See http://software.intel.com/en-us/blogs/2011/10/11/getting-started-on-android-for-x86-step-by-step-guide-on-setting-up-android-2223-for-x86-testing-environment-in-oracle-virtualbox/ for step-by-step instructions.

###

Some tips if you still want to try to use the default emulator:

1) Reduce screen size. Don’t bother to build an emulator with 1280×800 screen, the emulator will choke on it as it only uses one CPU/process (not sure) to do all translation from ARM to MacOS and back again and does all of the screen rendering in software. I think the general recommendation is to stay with 800×480 or 1024×700. Less pixels = less lag. Heck try a 480×320, if its really bad on your machine.

2) If you can use an older version of the SDK like 1.6, do so. Some of the performance gets used up by the fancier home screens of Froyo and Gingerbread.

3) Allocate more memory to the emulator. If you are using eclipse:
Go to Preferences.
Select “Launch”
ADD “-partition-size 1024” on the “Default emulator option”
Click “Apply”
You may have done this already but added for clarity.

[MC] Oops (3) was parition-size, -m is for memory.

###

Try genomotion emulator!
Its very fast, and way lighter than the other simulators*!

  1. Go here https://cloud.genymotion.com/page/customer/edit/, and register
  2. Download the IntelliJ Idea/Android studio plugin, and the Application (works for Linux/Mac/Windows)
  3. Install the application. Install the plugin (Preferences/Plugins/Install from disc)
  4. Open application. Login with registration credentials. Download from genymotion’s cloud an image (eg nexus7 w/o gapps)
  5. Select in IntelliJ/Android Studio the genymotion icon, and the select the path of the Application
    1. Run your app in genymotion emulator! Note: it will appear as “USB Device” and NOT as emulator!

*I have tried nexus7 w/ intels HAXM. Its super fast too, but its very heavy! Genymotion is much lighter!

Edit2: some weird error I faced using this emulator. When running the emulator, I could add text input to EditText if physical keyboard language was not english!

Leave a Reply

Your email address will not be published. Required fields are marked *