Android emulator laggy on Mac

25,642

Solution 1

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.

Solution 2

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.

Solution 3

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!

Solution 4

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 1280x800 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 800x480 or 1024x700. Less pixels = less lag. Heck try a 480x320, 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.

Share:
25,642

Related videos on Youtube

lucas32
Author by

lucas32

Updated on September 20, 2020

Comments

  • lucas32
    lucas32 over 3 years

    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.

    • Dave Newton
      Dave Newton over 12 years
      It's an emulator; it's going to be slow.
    • lucas32
      lucas32 over 12 years
      Hmm the last time i used an emulator on a separate windows laptop it worked real smooth.
    • Dave Newton
      Dave Newton over 12 years
      Windows != OSX, etc. Lots of differences. It's not RAM in the virtual device that would speed things up, it's emulator program settings that could make a difference, if possible.
    • JimmyB
      JimmyB over 12 years
      Better get used to it :) The emulator is really slow and needs a lot of CPU power.
    • Jong
      Jong over 12 years
      The emulator is always slow.. Better debug on a real device.
    • Code Poet
      Code Poet over 12 years
      How much ram you got in your macbook pro? I'm running on a late 2011 model with 8 gigs of ram and lion. Things are slow, but certainly not as much as you describe.
    • bluevoid
      bluevoid over 12 years
      If it's the audio that's lagging, then that's faithful emulation: code.google.com/p/android/issues/detail?id=3434 badoom boom tish
    • Pedro
      Pedro over 11 years
      It can finally be virtualised using the official Android tools, it will run a native speeds even with GPU acceleration. stackoverflow.com/a/10754883/1031077
  • SuperSkunk
    SuperSkunk about 11 years
    I needed to restart Eclipse in order to have the CPU/ABI Intel Atom (x86) option.
  • Paschalis
    Paschalis almost 11 years
    I installed a nexus7 image, with stock options, and changed: resolution to: 13 inches, enabled HAX(w/ intel Atom x86 as CPU of course), and enabled host GPU. damn fast! A previous attempt on nexus10(with stock resolution) was VERY laggy & HEAVY!
  • momo
    momo almost 11 years
    As of now the SDK installs the current HAX version. BTW, this answer should be accepted! (Saludos de Victor MMS ;-)
  • jfroom
    jfroom almost 11 years
    I got the 4.1.2 and 4.2.2 emulators to run quite snappy now, thanks to this answer.
  • iOS-Coder
    iOS-Coder over 10 years
    This Genymotion is really fast and makes me happy! Best tip I've found so far for my late 2009 MacMini running MountainLion-server. Thanks very much Paschalis!
  • iOS-Coder
    iOS-Coder over 10 years
    I've been playing with other AVD/emulator settings. Using a Nexus-One AVD 800x480 with default settings and enabling the snapshot, decreased my boot/startup time from 8 minutes to 2 minutes. However the display updates are still terribly slow, especially device-rotation! Unfortunately I couldn't enable the 'Use host GPU' together with the 'Snapshot' feature. My setup: late 2009 MacMini, 4 GB-RAM 1067 MHz DDR3, 2.53 GHz Intel Core 2 Duo, NVIDIA GeForce 9400 256 MB, OSX 10.8.5
  • Morrison Chang
    Morrison Chang over 10 years
    @iOS-Coder If you check the emulator page developer.android.com/tools/devices/emulator.html you'll see that 'Snapshot' and 'GPU' are exclusive so you can only do one or other. 'Snapshot' is only good for restarting and normally I just leave the emulator running all day so I would choose 'GPU' over 'Snapshot'. Looks like you found Genymotion so good luck!
  • Alessio Dal Bianco
    Alessio Dal Bianco over 10 years
    You saved me from thousand of hours spend for nothing !
  • Zeyad Shaban
    Zeyad Shaban over 3 years
    At first it was slow but after using it for sometime it became very fast. Maybe it was doing some caching? Thank you so much for recommending this!