標籤:
過程中,增大對應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試試:
結果問題依舊。
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:
然後用這個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. 手動改了後,結果會導致介面中無法正確顯示:
總之,還是很悲催,bug還是很大的說。
2.雖然改為1024MB,甚至2048MB,但是實際上運行AVD的時候,貌似還是原始的(我所選的那個裝置Nexus的)343MB:
總之,更加坑爹。。。
Android ADT中增大AVD記憶體後無法啟動:emulator failed to allocate memory 8