How to overcome the 2 GB RAM limit on Android Visual Studio 2015 emulators

Good evening everybody!

As a devoted Xamarin dev, as soon as it got available, I installed Visual Studio 2015 Release Candidate on both my work machines, my desktop PC (with 16 GB of RAM) and my Surface Pro 3 (with “just” 4 GB of ram).

And this is where the issue raised: I tried running the new Visual Studio 2015 Android emulator, boosted by Hyper-V, on both PCs, but it relentlessly failed to launch multiple times on my Surface Pro 3, always returning this error:

Android Emulator 2048 MB error

“Visual Studio Emulator for Android: The emulator is unable to verify that the virtual machine is running: Not enough memory is available in the system to start an emulator that uses 2048 MB of startup RAM. Please close other applications and try to launch the emulator again. If closing other applications doesn’t help, please follow the instructions on this KB article: http://support.microsoft.com/kb/2911380/en-us”

And that’s what I did! I slavishly followed every single step that was suggested by that Microsoft article, and this would have theoretically led me to have a running Hyper-V Android emulator on my PC, but upon several restarts and attempts, nothing changed.

That’s where I opened the Hyper-V Manager and manually modified the settings of the Emulator “VS Emulator 5-inch KitKat (4.4) XXHDPI Phone.guido”, in order to make it need 1024 MB instead than 2048 MB. It may have worked out at first, but Visual Studio thought: “Why did he change the required RAM to 1024 MB? Hey! Let’s revert it to 2048 MB, so his poor PC won’t be capable of handling it!” (yeah, I have around 1.5 GB of free RAM, sadly, with just Visual Studio 2015 running on my SP3).

In complete despair, I started wandering in the Visual Studio installations folders on my PC, to check where the heck it was forcing the starting RAM of the emulator to be exactly 2048 MB. I encountered some files that didn’t help me at all, but at last I found the right ones, modified them and, upon trying again, my Hyper-V Android emulator was running great on my Surface Pro 3! πŸ˜€

The configuration (.cfg) files you have to modify are located here:

C:\Users\[YourUserName]\AppData\Local\Microsoft\VisualStudioEmulator\Android\Containers\Local\Devices

Just head to this URL and you will find the four little bastards:

FilesToModify

Now you will just have to open each one of them and change this line content, replacing the “2048” value with “1024”:

FROM: device.vm.ram.size=2048
TO: device.vm.ram.size=1024

While I didn’t try if the emulators were launching with lower RAM values, I suppose that it’s possible reducing the RAM size until 512 MB without incurring in major issues (and unless you are debugging a game or something as heavy). All I can say is that with 1024 MB the Hyper-V Android emulators run just as fine as they run with 2048 MB on my desktop PC.

I am leaving here a link to download a .zip file to make you able to download the four files, already patched and such: http://1drv.ms/1QjZExk

Well, this is what worked for me! πŸ™‚ Feel free to post below here for more support, should you still have that infamous screen show up after following my guide!

Happy coding! πŸ™‚

29 pensieri su “How to overcome the 2 GB RAM limit on Android Visual Studio 2015 emulators

  1. Hello again! I am planning to buy a Surface Pro 3 and I also want to use the emulator on it. I have two questions:
    1) Is 4GB of RAM enough to run Visual Studio + the emulator + a web browser with many windows each having multiple tabs? And by enough, I mean without having to wait at all while going back and forth between all 3 programs, plus having the ability to open the files explorer or the calculator or the start menu also without waiting.

    Or should I buy the 8GB one?

    2) Can you really use the emulator on such a small screen? Can you see the text clearly and deal with the controls/views easily, or is it annoying?

    Thanks!

    • Hello!

      1) I am currently using the 4 GB one, and it actually runs without any issue, in the exact same scenario you are going to need. There is absolutely no lag, and you can run any emulator fine, obviously no more than one at once. The tricks I wrote in this post will help you in running even Android emulators fine. I bought the 4 GB one because of the 300$ difference with the 8 GB one, and that wasn’t just negligible!

      2) Emulators, as everything else, are just fine and suffer no problem given by the small screen. Also, you can use them via touchscreen, and that’s truly epic and useful. You should try that out! πŸ˜€

      I am available to solve more issues or answer questions! πŸ™‚

      Guido

  2. Excellent! Thank you very much. I thought I was being smart after changing the Hyper V settings and, like you saw VS change them back on me. Very happy to have found this article.

    I also found the following MS doc talking about changing a registry setting to help with this but they are referring to the Windows Phone emulator so I am not sure if it would effect the Android emulator or not as I have not tried it myself and do not plan to if this method continues to work for me.

    https://support.microsoft.com/en-us/help/2911380/-not-enough-memory-error-message-and-windows-phone-8-emulator-does-not

Rispondi

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione / Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione / Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione / Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione / Modifica )

Connessione a %s...