Android studio emulator fails to start with memory

2019-01-18 03:33发布

问题:

I'm trying to run my first android studio project but I get this error message and the emulator doesn't start :

Created filesystem with 11/4224 inodes and 1302/16896 blocks
Failed to create Context 0x3005
emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.
emulator: WARNING: Requested RAM size of 1536MB is too large for your environment, and is reduced to 1152MB.
emulator: device fd:544
HAX is not working and emulator runs in emulation mode
emulator: The memory needed by this VM exceeds the driver limit.
Cannot set up guest memory 'pc.ram': Invalid argument

回答1:

  • From Android studio open Windows->Select Android Virtual Device Manager->Chose your device->Click Edit button->Change the RAM parameter to 512 Mb in the Memory Options->Save and run the emulator it will work
  • Else you may use Genymotion Android Vm: https://www.genymotion.com/?utm_source=dlvr.it&utm_medium=twitter#!/download


回答2:

After Android Studio is installed

In CMD (Run As Admin) execute this command (Emulator should be closed):

//if it's installed on D:, at first, "cd" to that drive, like  "D:"
cd "%ANDROID_SDK_HOME%\sdk\extras\intel\Hardware_Accelerated_Execution_Manager"
silent_install.bat -m 1024

this will set HAXM memory to 1024Mb (max 1800). Set RAM parameter in VDM slightly below this value, like 980

If you are using Mac OS then use navigate to path /<USER_DIR>/Library/Android/sdk/extras/intel/Hardware_Accelerated_Execution_Manager and execute sudo ./silent_install.sh -m 1024



回答3:

Try restarting your computer!

I was just wrestling with this problem and after an hour of scouring the web to no avail I tried restarting my computer and the problem was resolved.



回答4:

In Android Studio, version 1.2.1.1:

Go to "Tools -> Android -> AVD Manager -> Chose your device -> Edit -> Advanced Settings -> Change the RAM parameter to 512 Mb.

Save it, and run the App in the Emulator. It should run now.



回答5:

It seems that the AVD does not like to set the memory in GB. If it does not save the new setting in GB change it to MB.



回答6:

If you are using Android studio and facing problem with emulator Ram size then follow the step:

Go to Tools -> Android -> AVD Manager -> (select you device ) -> Edit device -> Show advanced setting -> New Device -> Choose Change button -> New Hardware profile -> Change the Memory size to 512M -> Edit device in the right bottom corner then -> finish.



回答7:

In my case, this issue happened when I click run twice unintentionally from AVD manager. I resolved this issue by killing the running instance from taskmanager (qemu-system-i386.exe).



回答8:

I tried the above answers in Android Studio 3.0, but it seems AS 3.0 doesnt allow to change in the IDE screen, or not sure it was some problem with my installation. So I opened the AVD in disk and opened the config.ini, and changed the ramsize there. It worked.