为什么我无法从具有 1024 MB RAM 的 Eclipse 启动 AVD?

发布于 2024-12-26 18:32:18 字数 757 浏览 3 评论 0原文

因此,就像很多人开始使用 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:

enter image description here

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

烟─花易冷 2025-01-02 18:32:18

来自 Galaxy s3 模拟器

设置 AVD 时有一个常见问题,您必须手动编辑要修复的配置文件。文件位于 C:\Documents and Settings\username\.android\avd\name_of_avd.avd\config.ini

将内存设置从

hw.ramSize=1024

更改为

hw.ramSize=1024MB

(不要在记事本中启用自动换行)。

保存文件并重新打开 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

hw.ramSize=1024

to

hw.ramSize=1024MB

(Do not enable word wrap in notepad).

Save the file and reopen the avd.
This worked for me.

木有鱼丸 2025-01-02 18:32:18

很奇怪,但这对我在具有 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.

凉薄对峙 2025-01-02 18:32:18

我偶尔也会遇到同样的问题,我无法确切地告诉你为什么会出现这个问题,但如果在启动时分配的内存超过可用 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.

相权↑美人 2025-01-02 18:32:18

尝试在没有 Eclipse 的情况下启动 AVD 以删​​除该因素。
这可以通过导航到您的 SDK 路径/工具并打开 Android(.bat?),然后选择 AVD 管理器来完成。

我建议打开命令外壳,导航到路径,然后运行

emulator -avd AVDNAME -scale 0.7 -no-boot-anim 

您也可以尝试在不使用比例参数甚至更低的数字的情况下启动它。

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

emulator -avd AVDNAME -scale 0.7 -no-boot-anim 

You can also try starting it without the scale parameter or maybe even a lower number.

荒路情人 2025-01-02 18:32:18

在 Windows 上,根据系统负载,模拟大于 768 的 RAM 可能会失败
在此处输入图像描述

On Windows, emulating RAM greater than 768 may fail depending on the system load
enter image description here

一身骄傲 2025-01-02 18:32:18
  1. 打开 C:\Users\your user.android\avd\yourAVD.avd\config.ini
  2. 更改

    hw.ramSize=1024

hw.ramSize=1024M

这对我有用:-)
希望它会有所帮助!

  1. Open C:\Users\your user.android\avd\yourAVD.avd\config.ini
  2. change

    hw.ramSize=1024

to

hw.ramSize=1024M

this worked for me :-)
hope it will help!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文