Why can't I boot an AVD from Eclipse with 1024 MB of RAM?

微笑、不失礼 提交于 2019-12-03 06:19:09

问题


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.


回答1:


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.




回答2:


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.




回答3:


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.




回答4:


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.




回答5:


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




回答6:


  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!



来源:https://stackoverflow.com/questions/8853541/why-cant-i-boot-an-avd-from-eclipse-with-1024-mb-of-ram

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!