Saturday, May 25, 2013

Eclipse Error: Failed to allocate memory: 8 (Android Development)

I not new to programming but I am new to developing for Android mobile platforms so I was excited to begin learning how to develop apps for Android.  As I'm just about to get the SDK to run my first "Hello World" app on a the device emulator I got and error: "Failed to allocate memory: 8".

Background

Editing the virtual Android device settings manually in Android Virtual Device Manager for the device I had named VirtNexus7.

The fix for "Failed to allocate memory: 8"?

On my Windows 7 PC I had to go to: C:\Users\[User Name]\.android\avd\VirtNexus7.avd\Config.ini Edit the config file with a text editor.

In this case I had to change "hw.ramSize=1024" to "hw.ramSize=1024MB".

Also, to avoid such headaches, I would recommend that you only use the Android Virtual Device Manager's built-in virtual device presets to build your virtual device.  I've never had a problem when I've used it create new virtual devices for testing.



Below are the settings from the Config.ini file that I had created manually for the emulated virtual Nexus 7 device:

avd.ini.encoding=ISO-8859-1
hw.dPad=no
hw.lcd.density=213
sdcard.size=1024M
hw.cpu.arch=arm
hw.device.hash=-2113695447
disk.dataPartition.size=300M
hw.gpu.enabled=yes
skin.path=800x1280
skin.dynamic=yes
hw.keyboard=yes
hw.cpu.model=cortex-a8
hw.ramSize=1024
hw.device.manufacturer=Google
hw.sdCard=yes
hw.mainKeys=no
hw.accelerometer=yes
skin.name=800x1280
abi.type=armeabi-v7a
hw.trackBall=no
hw.device.name=Nexus 7
hw.battery=yes
hw.sensors.proximity=no
image.sysdir.1=system-images\android-17\armeabi-v7a\
hw.sensors.orientation=yes
hw.audioInput=yes
hw.camera.front=none
hw.gps=yes
vm.heapSize=32

2 comments:

  1. Call: 'adb shell' and later 'cat proc/meminfo'. Look for TotalMem field...It`s not 1024 MB :/

    ReplyDelete