为什么我无法从具有 1024 MB RAM 的 Eclipse 启动 AVD?
因此,就像很多人开始使用 Eclipse 进行 Android 开发一样,即使机器速度很快,我也注意到模拟器运行速度慢得令人沮丧。
我搜索了任何让它运行得更快的技巧,并且遇到了 这个问题,其最佳答案表明有几件事,包括让 AVD 拥有更多 RAM。他们建议 1024MB:
听起来不错。但当我尝试启动它时,我得到了这样的信息:
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.
如果我将其设置为 512MB(默认为 256MB),则它可以正常启动。
但是为什么在具有 12GB 物理 RAM 的 Windows 7 x64 计算机上我不能将 1024MB 分配给 AVD?这是 Eclipse 的限制吗?模拟器限制? Java 的限制?我认为另一个问题中的人已经让它工作了,但我还没有弄清楚如何以及我在其他地方看到的大多数回复都说“是的,将其调低到 512MB”,这不是我正在寻找的答案。
So, like a lot of people starting Android development with Eclipse, even with a fast machine, I notice that the emulator runs frustratingly slow.
I search SO for any tips to make it run faster and I run across this question, whose top answer suggests a couple of things, including making the AVD have more RAM. They suggest 1024MB:
Sounds good. But when I try to launch it, I get 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.
If I set it to 512MB (up from the default 256MB) it launches fine.
But why, on a Windows 7 x64 machine with 12GB of physical RAM can I not allocate 1024MB to an AVD? Is it an Eclipse limitation? Emulator limitation? Java limitation? I presume the person in that other question got it working but I've yet to figure out how and most of the responses I see elsewhere say "yeah dial it down to 512MB" which is not the answer I'm looking for.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
来自 Galaxy s3 模拟器:
设置 AVD 时有一个常见问题,您必须手动编辑要修复的配置文件。文件位于 C:\Documents and Settings\username\.android\avd\name_of_avd.avd\config.ini
将内存设置从
更改为
(不要在记事本中启用自动换行)。
保存文件并重新打开 avd。
这对我有用。
From Galaxy s3 emulator:
There is a common problem when setting up the AVD that you have to manually edit the config file to fix. File is located at
C:\Documents and Settings\username\.android\avd\name_of_avd.avd\config.ini
Change the memory settings from
to
(Do not enable word wrap in notepad).
Save the file and reopen the avd.
This worked for me.
很奇怪,但这对我在具有 16GB RAM 的 Windows 7 x64 机器上有效。您必须在 config.ini 中的“hw.ramSize”末尾添加 MB。
我遇到了和OP写的同样的问题。另外,如果您需要 2 GB RAM,请写入 2048MB,模拟器将从 Eclipse 运行。
Weird, but this worked for me on Windows 7 x64 machine with 16GB of RAM. You do have to add MB at the end of "hw.ramSize" in config.ini.
I had the same problem like OP wrote. Also, if you need 2 gigabytes of RAM, write 2048MB and simulator will run from Eclipse.
我偶尔也会遇到同样的问题,我无法确切地告诉你为什么会出现这个问题,但如果在启动时分配的内存超过可用 RAM 的 X 百分比,AVD 似乎不会启动。
如果您将给定数量减少 50mb,您通常会发现它运行得很好。或者,类似地,如果您关闭一些程序以节省一些 RAM,它也将正常启动。
我知道这并不理想,但我建议少量减少分配的 RAM,直到启动为止。我希望我能给出更好的答案,但我自己也找不到原因。
I have the same problem occasionally, and I'm unable to tell you exactly why this problem occurs, but it seems that the AVD won't start if it has been allocated more then an X percentage of your available RAM at the time of starting.
If you lower the given amount by just 50mb, you'll often notice it will run just fine. Or, similarly, if you close a few programs to save some RAM, it will also boot up perfectly fine.
I know it's not ideal, but I suggest to just lower the allocated RAM in small amounts until it boots up. I wish I could give a better answer but I haven't been able to find a reason myself either.
尝试在没有 Eclipse 的情况下启动 AVD 以删除该因素。
这可以通过导航到您的 SDK 路径/工具并打开 Android(.bat?),然后选择 AVD 管理器来完成。
我建议打开命令外壳,导航到路径,然后运行
您也可以尝试在不使用比例参数甚至更低的数字的情况下启动它。
Try starting the AVD without Eclipse to remove that Factor.
This can be done by navigating to your SDK-Path/tools and open Android(.bat?) and then select the AVD manager.
I would recommend opening a command shell, navigating to the path and then run
You can also try starting it without the scale parameter or maybe even a lower number.
在 Windows 上,根据系统负载,模拟大于 768 的 RAM 可能会失败

On Windows, emulating RAM greater than 768 may fail depending on the system load

更改
hw.ramSize=1024
为
这对我有用:-)
希望它会有所帮助!
change
hw.ramSize=1024
to
this worked for me :-)
hope it will help!