Android 模拟器无法分配内存 8

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11667907/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 08:24:44  来源:igfitidea点击:

Android emulator failed to allocate memory 8

androidandroid-emulator

提问by Vishwanath.M

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

当我尝试从 Eclipse 运行我的 WXGA800 模拟器时,它给出了这样的错误

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

分配内存失败:8

Android: failed to allocate memory

Android:无法分配内存

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

我曾尝试减少模拟器中的 RAM 大小并增加 Java heapsize 和 ramsize,但我仍然面临同样的错误。

回答by Lin-Art

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

更新:从 Android SDK Manager 版本 21 开始,解决方案是编辑C:\Users\<user>\.android\avd\<avd-profile-name>.avd\config.ini和更改值

hw.ramSize=1024 

to

hw.ramSize=1024MB

Android 4.2 API 17

安卓 4.2 API 17

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

模拟器真的很慢 希望他们能尽快发布英特尔图像如果您想更改它,请使用新的 API17 Intel x86 映像..(HAXM配置



Earlier Android SDK Manager releases:

早期的 Android SDK 管理器版本:

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

内置 WXGA800 皮肤也有同样的问题。我通过将虚拟设备设置编辑为:

  • 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
  • 目标 4.0.3 API 15 / 4.1.0 API 16
  • SD 卡 300MiB
  • 分辨率 1280 x 800(手动设置 - 不是内置的)
  • 设备 ram 大小 1024MB(将 MB 添加到数字中)
  • 抽象 LCD 160

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

这是我的 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

此配置也显示了软件密钥 屏幕截图 Android 4.1 模拟器 1280x800@160

回答by boing

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

回答by Marlos

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

在我的情况下,解决办法是不仅改变config.ini,而且hardware.ini从特定的皮肤hw.ramSize=1024hw.ramSize=1024MB

To find the hardware.inifile:

要查找hardware.ini文件:

  1. Open the config.iniand 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=1024to hw.ramSize=1024MB.
  1. 打开config.ini并找到skin.path
  2. 然后导航到android sdk所在的文件夹。
  3. 打开路径,像这样:android-sdk\platforms\android-15\skins\WXGA720
  4. 在此文件夹中,您将找到hardware.ini.
  5. 更改hw.ramSize=1024hw.ramSize=1024MB

回答by Alexander Zaldostanov

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

更新:从Android SDK Manager 21版开始,解决办法是编辑C:\Users\.android\avd\.avd\config.ini,修改值

hw.ramSize=1024 to

hw.ramSize=1024 到

hw.ramSize=1024MB

hw.ramSize=1024MB

OR

或者

hw.ramSize=512MB

hw.ramSize=512MB

回答by ptashek

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.

如果您将 AVD RAM 设置为大于模拟器能够分配的单个最大连续内存块的任何内容,则会触发此错误。关闭任何重 RAM 的东西,启动你的模拟器,启动你需要的一切。在之前的回答中,我将其限制为使用 IntelHAXM 的 x86 图像,但这实际上适用于所有类型的模拟器实例。

回答by back2back

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

在 AVD 设置中:将 CPU/ABI 选项更改为 MIPS。它对我有用

回答by Paul

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.

我遇到了同样的问题,最终的问题是 RAM 大小:显然 1024(或任何大小)与 1024MB 不同。确保您指定了单位,它应该适合您。

回答by Namrata

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

更改 config.ini 文件中的 ramSize 对我不起作用。

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

我在“编辑 Android 虚拟设备”窗口中将 SD 卡大小更改为 1000 MiB ......它起作用了!:)

回答by FranzPhillips

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.

去编辑Android Virtual Devices,把内存选项下的1024改成768,如果还是不行,继续往下走。

回答by Sylar

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.

减少 AVD 设置中的 RAM 大小对我有用。缓慢的 AVD 会占用大量 RAM,因此将其保持在最低限度是可行的。