最新消息:20190529 VPS服务器已从腾讯云香港换为Vultr新加坡,主题仍用朋友推荐的大前端D8

【已解决】Android ADT中增大AVD内存后无法启动:emulator failed to allocate memory 8

Android crifan 4401浏览 0评论

【问题】

折腾:

【已解决】Android ADT中增大AVD内存后无法启动:emulator failed to allocate memory 8

过程中,增大对应AVD的内存为2G后,结果无法启动AVD了:

[2012-12-18 18:01:38 – Emulator] Failed to allocate memory: 8
[2012-12-18 18:01:38 – Emulator]
[2012-12-18 18:01:38 – Emulator] This application has requested the Runtime to terminate it in an unusual way.
[2012-12-18 18:01:38 – Emulator] Please contact the application’s support team for more information.

 

【解决过程】

1.所以,重新改小为1G试试:

1024MB mem

结果问题依旧。

2.参考:

Android Emulator: Failed to allocate memory: 8 even with 8MB RAM

说是,只能是256/512/1024

但是很明显,我上面改成1024也是不行的。

参考最后一个人的解释,去改为900MB,看到log为:

[2012-12-18 18:16:04 – SDK Manager] Snapshot image already present, was not changed.
[2012-12-18 18:16:04 – SDK Manager] SD Card already present with same size, was not changed.
[2012-12-18 18:16:04 – SDK Manager] Updated AVD ‘SamsungGalaxySII’ based on Android 4.2, ARM (armeabi-v7a) processor,
[2012-12-18 18:16:04 – SDK Manager] with the following hardware config:
[2012-12-18 18:16:04 – SDK Manager] hw.sdCard=yes
[2012-12-18 18:16:04 – SDK Manager] hw.device.manufacturer=Google
[2012-12-18 18:16:04 – SDK Manager] hw.mainKeys=yes
[2012-12-18 18:16:04 – SDK Manager] hw.lcd.density=240
[2012-12-18 18:16:04 – SDK Manager] hw.accelerometer=yes
[2012-12-18 18:16:04 – SDK Manager] hw.dPad=no
[2012-12-18 18:16:04 – SDK Manager] hw.device.hash=499058361
[2012-12-18 18:16:04 – SDK Manager] hw.trackBall=no
[2012-12-18 18:16:04 – SDK Manager] hw.device.name=Nexus S
[2012-12-18 18:16:04 – SDK Manager] hw.camera.back=none
[2012-12-18 18:16:04 – SDK Manager] hw.sensors.proximity=yes
[2012-12-18 18:16:04 – SDK Manager] hw.battery=no
[2012-12-18 18:16:04 – SDK Manager] disk.dataPartition.size=200M
[2012-12-18 18:16:04 – SDK Manager] hw.audioInput=yes
[2012-12-18 18:16:04 – SDK Manager] hw.sensors.orientation=yes
[2012-12-18 18:16:04 – SDK Manager] hw.camera.front=none
[2012-12-18 18:16:04 – SDK Manager] hw.gps=yes
[2012-12-18 18:16:04 – SDK Manager] skin.dynamic=no
[2012-12-18 18:16:04 – SDK Manager] hw.keyboard=no
[2012-12-18 18:16:04 – SDK Manager] vm.heapSize=32
[2012-12-18 18:16:04 – SDK Manager] hw.ramSize=900

然后再去试试,结果错误依旧。

3.改回之前配置的512MB,是可以的。

但是不是我想要的,想要的就是,尽量让内存大点,以此希望能让AVD模拟器跑的快点,不要这么慢。

4.再去改为768MB,结果又显示和之前的snapshot不一致,所以还不给启动:

[2012-12-18 18:19:00 – DownloadSongtasteMusic] ——————————
[2012-12-18 18:19:00 – DownloadSongtasteMusic] Android Launch!
[2012-12-18 18:19:00 – DownloadSongtasteMusic] adb is running normally.
[2012-12-18 18:19:00 – DownloadSongtasteMusic] Performing crifan.com.downloadsongtastemusic.MainActivity activity launch
[2012-12-18 18:19:00 – DownloadSongtasteMusic] Automatic Target Mode: launching new emulator with compatible AVD ‘SamsungGalaxySII’
[2012-12-18 18:19:00 – DownloadSongtasteMusic] Launching a new emulator with Virtual Device ‘SamsungGalaxySII’
[2012-12-18 18:19:00 – Emulator] emulator: ERROR: Unable to load VM from snapshot. The snapshot has been saved for a different hardware configuration.

5.所以,先去把snapshot去掉,然后再启动,启动后,关闭掉,再次勾选上snapshot。

结果还是同样提示:

ERROR: Unable to load VM from snapshot. The snapshot has been saved for a different hardware configuration

所以,估计只能是删除掉,重新建一个,也许才可以的。

6.重新新建一个AVD:

480x800 768MB mem

然后用这个AVD试试效果。

然后是可以启动的。

不过速度也还是很慢。

6.继续参考该贴,先去设置为1024MB,

然后再去把:

C:\Users\CLi\.android\avd\SamsungGalaxySII.avd\config.ini

中的:

hw.ramSize=1024

改为

hw.ramSize=1024MB

然后去运行试试,结果出现:

Emulator] emulator: ERROR: Unable to load VM from snapshot. The snapshot has been saved for a different hardware configuration.

再去取消掉snapshot,再运行,的确是可以运行的。

 

【总结】

结论是:

当前有个bug:

默认是通过

hw.ramSize=1024

来判断内存大小的,但是当是>=1024时,就无法正确识别了。

必须手动把对应的

C:\Users\CLi\.android\avd\SamsungGalaxySII.avd\config.ini

中的

hw.ramSize=1024

改为

hw.ramSize=1024MB

就可以了。

 

提示:

1. 手动改了后,结果会导致界面中无法正确显示:

not show 1024MB

 

总之,还是很悲催,bug还是很大的说。

2.虽然改为1024MB,甚至2048MB,但是实际上运行AVD的时候,貌似还是原始的(我所选的那个设备Nexus的)343MB:

max only 342MB

总之,更加坑爹。。。

转载请注明:在路上 » 【已解决】Android ADT中增大AVD内存后无法启动:emulator failed to allocate memory 8

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

网友最新评论 (4)

  1. 垃圾android,体验比ios差10倍,艹
    lanmanck5年前 (2014-09-26)回复
  2. 很有實驗精神!佩服~
    路人5年前 (2014-06-20)回复
  3. 希望日后Google能够改善这坑爹的BUG
    vallen6年前 (2013-07-15)回复
    • 好强好强,相当佩服
      zhangcheng5年前 (2014-11-02)回复
66 queries in 0.114 seconds, using 18.94MB memory