Android 模拟器:无法分配内存:即使使用 8MB RAM 也无法分配内存
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11281667/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android Emulator: Failed to allocate memory: 8 even with 8MB RAM
提问by nhaarman
I'm trying to start an emulator, but I keep getting the error Failed to allocate memory: 8
.
我正在尝试启动模拟器,但我不断收到错误消息Failed to allocate memory: 8
。
There are some solutions to this problem, setting the RAM from 1024 to 512, but when I even set it to 8 it still crashes with this error!
这个问题有一些解决方案,将 RAM 从 1024 设置为 512,但是当我将其设置为 8 时,它仍然因此错误而崩溃!
What should I do?
我该怎么办?
Screenshot of the settings:
设置截图:
Here the error message Windows gives of the crashed emulator-arm.exe:
这里是 Windows 给出的崩溃的 emulator-arm.exe 的错误消息:
Problem signature:
Problem Event Name: APPCRASH
Application Name: emulator-arm.exe
Application Version: 0.0.0.0
Application Timestamp: 4fe779fb
Fault Module Name: emulator-arm.exe
Fault Module Version: 0.0.0.0
Fault Module Timestamp: 4fe779fb
Exception Code: 40000015
Exception Offset: 0014428e
OS Version: 6.1.7600.2.0.0.768.3
Locale ID: 1043
Additional Information 1: ea2b
Additional Information 2: ea2b4716fbf9f89aacc15214fb1537bb
Additional Information 3: 8d2f
Additional Information 4: 8d2f162ccf8522e475fc4fbe036a6efa
The last time I checked and the emulator worked was before updating to ADT 20 and before deleting all old AVD's.
我最后一次检查和模拟器工作是在更新到 ADT 20 之前和删除所有旧的 AVD 之前。
回答by EGHDK
I've had problems like this. The only way to fix it was to set it to either 256, 512 or 1024. I have no idea why it won't work with any random value.
我遇到过这样的问题。修复它的唯一方法是将其设置为 256、512 或 1024。我不知道为什么它不适用于任何随机值。
回答by Furqan
You need to access avd config file that resides in:
您需要访问位于以下位置的 avd 配置文件:
C:\Users\Furqan\.android\avd\Gingerbread.avd
Here my user name is Furqan and Gingerbread.avd is the name of emulator device
there is config.ini
file there, you can change ramsize or vm.heapSize=128
hw.ramSize=2048mb
这里我的用户名是 Furqan 和 Gingerbread.avd 是模拟器设备的名称那里有config.ini
文件,您可以更改 ramsize 或vm.heapSize=128
hw.ramSize=2048mb
Makesure ramsize should be in mb and similarly you can change any thing in the emulator from here easily.
确保 ramsize 应该在 mb 中,同样您可以从这里轻松更改模拟器中的任何内容。
avd.ini.encoding=ISO-8859-1
hw.sdCard=no
hw.device.manufacturer=Google
hw.mainKeys=yes
hw.lcd.density=320
hw.accelerometer=yes
hw.dPad=yes
hw.cpu.arch=arm
skin.name=720x1280
abi.type=armeabi
hw.device.hash=-708107041
hw.trackBall=no
hw.device.name=Galaxy Nexus
hw.camera.back=emulated
hw.sensors.proximity=yes
hw.battery=yes
disk.dataPartition.size=200M
image.sysdir.1=platforms\android-10\images\
hw.audioInput=yes
hw.sensors.orientation=yes
hw.camera.front=emulated
hw.gps=yes
skin.dynamic=yes
skin.path=720x1280
hw.keyboard=yes
vm.heapSize=128
hw.ramSize=2048mb
Note: hw.ramSize
put mb in small case as upper case didnt work for me.
注意:hw.ramSize
将 mb 放在小写中,因为大写对我不起作用。
回答by Frank
Under Windows, no matter how much RAM you have in the PC, it seems setting the emulator around 900MB is about the max it can handle. 1024MB always fails for me with 6GB of RAM and Windows 7 x64.
在 Windows 下,无论您的 PC 有多少 RAM,将模拟器设置为 900MB 左右似乎是它可以处理的最大值。使用 6GB RAM 和 Windows 7 x64 时,1024MB 对我来说总是失败。
One other key note, for the device RAM Size, always include "MB" at the end. It seems to randomly works/crashes without it, but works reliably with it. Many pre-built emulators seem to leave this off. For example, use 900MB(no space).
另一个关键注意事项,对于设备 RAM 大小,始终在末尾包含“MB”。它似乎在没有它的情况下随机工作/崩溃,但与它一起可靠地工作。许多预先构建的模拟器似乎没有这样做。例如,使用900MB(无空间)。
回答by Prymaldark
As I mention here: https://stackoverflow.com/a/14420779/1993898
正如我在这里提到的:https: //stackoverflow.com/a/14420779/1993898
I was able to fix this error by running AVD "as Administrator", with no changes required to my emulator setup. To ensure clarity, my emulator is setup with '1024' in the RAM field, no MB tag needed. Therefore, I believe this error to be related to filesystem permissions, or lack thereof.
我能够通过“以管理员身份”运行 AVD 来修复此错误,而无需更改我的模拟器设置。为确保清晰,我的模拟器在 RAM 字段中设置为“1024”,不需要 MB 标签。因此,我认为此错误与文件系统权限有关,或与文件系统权限有关。
回答by T.Todua
Solved problem with:
解决了以下问题:
Open config.ini (location: C:\USERS\ YOURUSERNAME\.android\avd ) and set i.e.
打开 config.ini(位置:C:\USERS\ YOURUSERNAME\.android\avd)并设置 ie
hw.ramSize=512
to
到
hw.ramSize=512mb