Java Android Studio 模拟器启动失败,出现内存限制相关的错误信息
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28269121/
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
Android studio emulator fails to start with memory limit related error message
提问by Neo
I'm trying to run my first android studio project but I get this error message and the emulator doesn't start :
我正在尝试运行我的第一个 android studio 项目,但收到此错误消息并且模拟器无法启动:
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
采纳答案by Giridharan
- 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
回答by Samuel Kogan
After Android Studio is installed
安装 Android Studio 后
In CMD (Run As Admin) execute this command (Emulator should be closed):
在 CMD(以管理员身份运行)中执行此命令(应关闭模拟器):
//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
这会将HAXM 内存设置为 1024Mb (max 1800)。将 VDM 中的 RAM 参数设置为略低于此值,例如 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
如果您使用的是 Mac OS,则使用导航到路径/<USER_DIR>/Library/Android/sdk/extras/intel/Hardware_Accelerated_Execution_Manager
并执行sudo ./silent_install.sh -m 1024
回答by ArunDhwaj IIITH
In Android Studio, version 1.2.1.1:
在 Android Studio 中,版本 1.2.1.1:
Go to "Tools -> Android -> AVD Manager -> Chose your device -> Edit -> Advanced Settings -> Change the RAM parameter to 512 Mb.
转到“工具 -> Android -> AVD 管理器 -> 选择您的设备 -> 编辑 -> 高级设置 -> 将 RAM 参数更改为 512 Mb。
Save it, and run the App in the Emulator. It should run now.
保存它,然后在模拟器中运行应用程序。现在应该可以运行了。
回答by Zvi
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.
似乎AVD不喜欢以GB为单位设置内存。如果它不以 GB 保存新设置,请将其更改为 MB。
回答by Richard P. Zwiren Jr.
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.
我只是在解决这个问题,在网上搜索了一小时无济于事后,我尝试重新启动计算机,问题解决了。
回答by Aman Singh
If you are using Android studio and facing problem with emulator Ram size then follow the step:
如果您使用的是 Android Studio 并面临模拟器 Ram 大小的问题,请按照以下步骤操作:
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.
转到工具 -> Android -> AVD 管理器 ->(选择您的设备) -> 编辑设备 -> 显示高级设置 -> 新设备 -> 选择更改按钮 -> 新硬件配置文件 -> 将内存大小更改为 512M ->在右下角编辑设备,然后 -> 完成。
回答by Vino
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).
就我而言,当我从 AVD 管理器无意中单击两次运行时,就会发生此问题。我通过从任务管理器 (qemu-system-i386.exe) 终止正在运行的实例解决了这个问题。
回答by Subhankar Mukherjee
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.
我在 Android Studio 3.0 中尝试了上述答案,但似乎 AS 3.0 不允许在 IDE 屏幕中更改,或者不确定是我的安装出现问题。所以我在磁盘中打开了 AVD 并打开了 config.ini,并在那里更改了 ramsize。有效。