Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Running an app on the emulator

When I hit run to run my app on the emulator in android studio, the emulator is coming up but the screen is just staying black. Nothing else come sup except I noticed there is something that says "The memory needed by this VM exceeds the driver limit." I don't know what that means, if it's the problem, or how to fix it if it is the problem.

Sophie do you know what an emulator is? Do you want more explanation on what an emulator and a VM (virtual machine) are?

3 Answers

Sophie that means that your emulator takes more memory than your machine has to offer. The android emulator is a VM, which stands for virtual machine, which means a machine is running inside your computer (or a computer within a computer). The VM/emulator that comes with Android Studio is a memory HOG! It'll take as much as it can get! So there's 2 thoughts here. You can create an emulator in Android Studio that's emulating an older phone model (pre-Marshmellow)....like API 19 or 18 should be new enough...or Genymotion is a company that offers a free emulator that's by far less memory intensive and works with Android Studios, but you must have both open and running for Android Studio to "sense the presence" of Genymotion. http://genymotion.en.softonic.com/download

yeah some more information on it may be helpful

I realize now it also says "AXM is not working and emulator runs in emulation mode"

Hey Sophie, Ok, so elaborating on what an emulator is: -An emulator is almost an exact copy of the machine that your Android app would play on...like you can have an emulated phone or tablet (those are the most common emulation environments...meaning the most common things that you'd like to see your app work in). The action of an emulator is simply to imitate something else, typically software...so like when you open your phone or tablet you see the Android Operating System...and this would be the thing that the emulator in Android Studio is emulating -A virtual machine is a computer within a computer. So you're giving your android tablet all the same "powers" and functions of a real tablet including memory and other parts of your main computer.
You basically start with your computer and tell your computer ok, I want you to take resources from yourself and give it to another computer I'm going to run within you....kinda like a pregnancy (the baby lives inside the mom and feeds off of her resources). However, unlike a pregnancy your main computer actually doesn't understand that it's operating with 2 computers after you create a virtual machine. So if you allocate too much of your main computer's resources to the virtual machine your main computer will slow way down because it doesn't understand why all its normal resources are gone (it's gone to the VM!).

Or another way to look at this is it's like the VM is the actual tablet/phone and the emulator is the operating system inside it....and this all operates inside your computer, just like it would if you were holding a tablet/phone in your hand.

With the AXM error, I'm pretty sure that means that you've allocated too much memory to the virtual machine and didn't leave enough for your main computer. It might be worth it to check out this screenshot from StackOverflow: http://i.stack.imgur.com/SkWEN.png I typically dislike StackOverflow because it's a pretty advanced site, but this screenshot shows the memory allocation that fixed the person's AXM error problem. I'm not sure it'll work for you, but you can try! If it doesn't work, you can keep allocating less and less memory to the VM, but you also have to scale back what version of Android you're going to try to run on the VM....try API 12 for really low memory....but don't go below API 12 because the coding language is wildly different.