157

When I try to run my WXGA800 emulator from Eclipse it's giving an error like this

Failed to allocate memory: 8
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

I checked the following links also

Failed to allocate memory: 8

Android: failed to allocate memory

I have tried reducing RAM size in emulator and increasing Java heapsize and ramsize but still I am facing the same error.

Community
  • 1
  • 1
Vishwanath.M
  • 6,235
  • 11
  • 42
  • 56
  • try setting the resolution manually instead use the built-in skin. – SteveR Aug 07 '12 at 20:24
  • Please check out my answer here: http://stackoverflow.com/a/14420779/1993898 – Prymaldark Jan 20 '13 at 01:36
  • possible duplicate of [Failed to allocate memory: 8](http://stackoverflow.com/questions/7222906/failed-to-allocate-memory-8) – Peter O. Jan 29 '13 at 04:52
  • Cool. I worded this same question less eloquently and had people down vote it. I hope there is a great answer in here somewhere. I am trying to emulate the Samsung Galaxys with S-Pen support, and they are all exceeding the abilities of the emulator as well. – Sinthia V Jun 06 '13 at 20:32
  • http://stackoverflow.com/questions/11667907/android-emulator-failed-to-allocate-memory-8/11868277#11868277 – Frank Myat Thu Jun 20 '13 at 03:34

12 Answers12

410

Update: Starting with Android SDK Manager version 21, the solution is to edit C:\Users\<user>\.android\avd\<avd-profile-name>.avd\config.ini and change the value

hw.ramSize=1024 

to

hw.ramSize=1024MB

Android 4.2 API 17

The emulator is really slow, hope they will release the intel images soon use the new API17 Intel x86 images if you want to change it .. (HAXM, Configuration)


Earlier Android SDK Manager releases:

Had the same problem with the built-in WXGA800 skin. I got it working by editing the virtual device setup to:

  • Target 4.0.3 API 15 / 4.1.0 API 16
  • SD-card 300MiB
  • Resolution 1280 x 800 (set manually -not the built-in ones)
  • Device ram size 1024MB (with MB added to the number)
  • Abstracted LCD 160

Here my tablet config for 4.1.0 API 16 C:\Users\<user>\.android\avd\<avd-profile-name>.avd\config.ini

hw.lcd.density=160
sdcard.size=300M
skin.path=1280x800
skin.name=1280x800
hw.cpu.arch=arm
abi.type=armeabi-v7a
hw.cpu.model=cortex-a8
vm.heapSize=48
hw.ramSize=1024MB
image.sysdir.1=system-images\android-16\armeabi-v7a\

This config shows the software keys too Screenshot Android 4.1 emulator 1280x800@160

Lin-Art
  • 4,933
  • 2
  • 26
  • 31
  • 2
    +1 I took this advice and then started the emulator from the command line to get this to work. Hope Xavier will save us from this flakeyness soon.... – BrantApps Oct 18 '12 at 21:34
  • 9
    I made the error go away by reducing the "Memory Option: RAM" to 512 and setting SDcard Size to 300MiB. – Someone Somewhere Nov 22 '12 at 00:05
  • I had the exact same problem with the Kindle Fire emulator. I only had to add "MB" to the hw.ramSize parameter to get it working. Increasing the heap size or RAM size wasn't necessary but doesn't hurt. – Barry Fruitman Dec 04 '12 at 22:37
  • 1
    Mine got working after turning the RAM from 1024 to "1024**MB** (with MB added to the number)". Thx Lin-Art – denispyr Dec 09 '12 at 23:22
  • 1
    adding MB fixed the memory issue but i am getting "unfortunately, system UI has stopped" error now :( – Damodar Bashyal Jan 08 '13 at 08:02
  • 1
    I read elsewhere that adding MB in the VDM to a device RAM will actually target the default RAM amount. Is this true? – Ben Sewards Feb 05 '13 at 03:06
  • Like in here http://developer.android.com/tools/devices/managing-avds.html > Hardware options: Device ram size ? – Lin-Art Feb 05 '13 at 04:11
  • 1
    This has worked for me. One thing I found is if I needed to make a change to the AVD later (e.g. add an SD card or turn on snapshot), the value for hw.ramsize is not in the dialog and you have to fill it in for the OK button to appear. By setting this back to 1024 (or whatever), you've rewritten the config.ini and you will need to manually modify it again. – Eric Cloninger Feb 10 '13 at 17:29
  • 3
    Seriously, what a stupid bug... /facepalm At least I can progress now! Thank you! – mrswadge Nov 09 '13 at 20:01
  • 2
    wow. this is terrible. the official SDK and testing kit doesn't properly handle this? you've got to edit .ini files by hand, and that's been the case for nearly a year? that is insane. – matt lohkamp Nov 19 '13 at 01:25
  • 1
    Very surprised that worked. I guess because I am surprised that has been an unfixed bug this long. – theblang Feb 15 '14 at 21:31
  • What's the path on Mac? – user83039 Nov 09 '14 at 05:26
67

This following solution worked for me. In the following configuration file:

C:\Users\<user>\.android\avd\<avd-profile-name>.avd\config.ini

Replace

hw.ramSize=1024

by

hw.ramSize=1024MB
boing
  • 679
  • 5
  • 2
  • 1
    Not sure why but this fixed it. Thanks – schar Dec 06 '12 at 16:39
  • 1
    Good spot, this must be a bug... I followed the files convention and just used an M, which also worked. – HGPB Dec 09 '12 at 19:10
  • 17
    Kinda pathetic on Google's part, really. Do they not test? – Cory Trese Dec 13 '12 at 03:02
  • +1 This works to me. Maybe it is because when I specified the ram size I select 1 GB. – Eng.Fouad Dec 14 '12 at 04:23
  • 4
    In other answer somebody claimed that the "MB" is not actually recognised and changing from 1024 to 1024MB actually reduces the memory to 256MB which is default and therefore it starts working. Source: http://stackoverflow.com/questions/7222906/failed-to-allocate-memory-8 – Juha Palomäki Oct 07 '13 at 12:55
  • It looks like after installing Android Studio I got all bugs possible. Thank you StackOverflow. This fix it. – Adrian P. Sep 12 '15 at 22:59
9

In my case, the solution was to change not only config.ini but also hardware.ini for the specific skin from hw.ramSize=1024 to hw.ramSize=1024MB.

To find the hardware.ini file:

  1. Open the config.ini and locate skin.path.
  2. Then navigate to the folder where the android sdk is located.
  3. Open the path, like this: android-sdk\platforms\android-15\skins\WXGA720.
  4. Inside this folder you will locate the hardware.ini.
  5. Change hw.ramSize=1024 to hw.ramSize=1024MB.
Marlos
  • 1,927
  • 2
  • 22
  • 44
5

Update: Starting with Android SDK Manager version 21, the solution is to edit C:\Users\.android\avd\.avd\config.ini and change the value

hw.ramSize=1024 to

hw.ramSize=1024MB

OR

hw.ramSize=512MB

Alexander Zaldostanov
  • 2,907
  • 4
  • 30
  • 39
3

This error fires if you set the AVD RAM to anything that is larger then the single largest block of continuous memory the emulator is able to allocate. Close anything RAM heavy, start your emulator, start everything else you need. In a previous answer I have limited this to x86 images with IntelHAXM, but this actually is the case for all types of emulator instances.

ptashek
  • 186
  • 2
  • 6
3

In the AVD setup: Change the CPU/ABI option to MIPS. It worked for me

back2back
  • 113
  • 11
1

I had the same problem and what ended up being the issue was the RAM size: apparently 1024 (or whatever size) is different from 1024MB. Make sure you specify the units and it should work for you.

Paul
  • 120
  • 1
  • 8
1

Changing the ramSize in config.ini file didnt work for me.

I changed the SD Card size to 1000 MiB in Edit Android Virtual Device window ...It worked! :)

Namrata
  • 11
  • 1
  • Are you sure your answer relates to the problem? Because the problem appears to relate to RAM, which is not going to change if one changes the SD card size. – class stacker Mar 13 '13 at 10:51
0

Go to edit Android Virtual Devices and change the 1024 Under Memory Options to 768. If it still doesn't work, keep going lower and lower.

0

Reducing the RAM size in the AVD settings worked for me. The AVD being slow can eat up a lot of RAM, so keeping it at a minimum is feasible.

Sylar
  • 162
  • 1
  • 6
0

For Skin remove No Skin and add some skin into it

enter image description here

Jimit Patel
  • 4,265
  • 2
  • 34
  • 58
0

Try this if other answers did not work for you.

For me This happened for API 27 Emulator.

API 26 Emulator worked just fine. So I started API 26 Emulator first and then closed it.

Then I started API 27 Emulator and It worked with No errors at all.

Akshar Patel
  • 8,998
  • 6
  • 35
  • 50