为什么我不能从具有 1024 MB RAM 的 Eclipse 启动 AVD?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8853541/
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
Why can't I boot an AVD from Eclipse with 1024 MB of RAM?
提问by Tom Kidd
So, like a lot of people starting Android development with Eclipse, even with a fast machine, I notice that the emulator runs frustratingly slow.
因此,就像许多使用 Eclipse 开始 Android 开发的人一样,即使使用快速的机器,我也注意到模拟器运行速度慢得令人沮丧。
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:
我搜索任何提示以使其运行得更快,我遇到了这个问题,其最佳答案提出了一些建议,包括使 AVD 具有更多 RAM。他们建议使用 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.
如果我将它设置为 512MB(高于默认的 256MB),它可以正常启动。
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.
但是,为什么在具有 12GB 物理 RAM 的 Windows 7 x64 机器上,我不能将 1024MB 分配给 AVD?它是 Eclipse 的限制吗?模拟器限制?Java限制?我认为另一个问题中的人让它起作用了,但我还没有弄清楚我在其他地方看到的大多数回答是如何以及大多数回答说“是的,将它调低到 512MB”,这不是我正在寻找的答案。
回答by user2005091
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
设置 AVD 时有一个常见问题,您必须手动编辑配置文件才能修复。文件位于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.
保存文件并重新打开 avd。这对我有用。
回答by user2410173
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.
奇怪,但这在具有 16GB RAM 的 Windows 7 x64 机器上对我有用。您必须在 config.ini 中“hw.ramSize”的末尾添加 MB。我有和 OP 写的一样的问题。此外,如果您需要 2 GB 的 RAM,请写入 2048MB,模拟器将从 Eclipse 运行。
回答by Mohamed El-Nakib
On Windows, emulating RAM greater than 768 may fail depending on the system load
在 Windows 上,模拟大于 768 的 RAM 可能会失败,具体取决于系统负载
回答by NO... Bugs...
- Open C:\Users\your user.android\avd\yourAVD.avd\config.ini
change
hw.ramSize=1024
- 打开 C:\Users\your user.android\avd\yourAVD.avd\config.ini
改变
hw.ramSize=1024
to
到
hw.ramSize=1024M
this worked for me :-) hope it will help!
这对我有用:-)希望它会有所帮助!
回答by Sander van't Veer
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.
我偶尔会遇到同样的问题,我无法确切地告诉您为什么会出现此问题,但是如果在启动时分配的可用 RAM 超过 X 百分比,则 AVD 似乎不会启动.
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.
如果您将给定的数量降低 50mb,您通常会注意到它会运行得很好。或者,类似地,如果您关闭一些程序以节省一些 RAM,它也会很好地启动。
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.
我知道这并不理想,但我建议在启动之前少量降低分配的 RAM。我希望我能给出更好的答案,但我自己也找不到原因。
回答by Force
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.
尝试在没有 Eclipse 的情况下启动 AVD 以删除该因素。这可以通过导航到您的 SDK-Path/tools 并打开 Android(.bat?) 然后选择 AVD 管理器来完成。
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.
您也可以尝试在没有 scale 参数的情况下启动它,或者甚至可以使用更低的数字。