Install, Optimize, and Run the Eclipse Android Emulator for Mac, Windows and Linux

Install, Optimize, and Run the Eclipse Android Emulator for Mac, Windows and Linux

Getting started with Android can sometimes be a daunting process.   You have to install the Eclipse, configure Android Developer Tools to function within Eclipse, then, if you don’t have an Android Device to work with, set-up an emulator so that you can develop, test and debug your new Android program.

 

Getting Started

The first step, if you haven’t already done so, is to download Eclipse and install Android Developer Tools.

Eclipse can be downloaded here: https://www.eclipse.org/downloads/

The Android Developer Tools can be found here: https://developer.android.com/sdk/index.html

Before we begin to set up the VM, we need to be sure that we have downloaded the appropriate SDKs

Click Window -> Android SDK Manager

I would recommend checking all boxes from the most recent SDK (at the top) all the way to Android 3.2 (API 13). If you’re reading this a few years in the future, you might consider ignoring a few of the older SDKs. It just depends on who compatible you want your VM to be.

Take a moment to recognize that we are also installing Intel x86 System Images. These are the devices OS and will be necessary later during the setup.

Setup

Once you have Eclipse and ADT set up, you’ll want to set up your emulator.

Select Android Virtual Device Manager

 

Click Window -> Android Virtual Device Manager

 

Create new Virtual Device

Select Create

 

The next window can look a little daunting to someone who has never worked with Android. But have no fear, I’ll walk you through each step.

 

  1. Enter a name for your “device.” You can only use alphabetic characters and numbers.   Eclipse with complain if you add dashes, quotes, and the like.
  2. Choose your device. Different devices will require different CPU emulators.   I’ve chosen the Nexus 7 from 2012 for this demonstration as we can use multiple CPU VMs with this device.
  3. Choose a Target API. Your target API is going to depend largely on your project and its dependencies. For this example, I’ll choose Android 4.4.2 – API Level 19.
  4. The next thing we need to do is choose the VMs CPU. My recommendation here is to select the Intel Atom x86 for reasons that will become clear when we discuss optimizing the emulator for speed.
  5. Choose the skin. This isn’t particularly important. It will change the look of the “outside” of your emulator.
  6. If you are using the camera in your application, go ahead and select the appropriate response now. This is beyond the scope of this tutorial.
  7. The next option, Memory Options, is very important. The Android emulator is a memory hog, so you’ll want to set aside a gig or more of RAM for your VM.
  8. Set your internal storage. If you are using a Content Provider, photos, or other hard drive intensive features for your application, you’ll want to allocate more of your system’s memory to Internal Storage.
  9. Allocate memory for an SD Card. This relatively innocuous field is the primary impetus for creating this guide. I spent an hour trying to figure out why I was unable to store certain things in the emulator to no avail. I stumbled upon a post about the SD Card, reconfigured the emulator, and all was well.

If you’ve been following along, you’re settings should look something like this:

Click OK.

 

Optimize the Emulator

Before we start the emulator, we want to install a nifty little piece of software from Intel called the Intel Hardware Accelerated Execution Manager (Intel® HAXM). HAXM “is a hardware-assisted virtualization engine (hypervisor) that uses Intel Virtualization Technology (Intel® VT) to speed up Android app emulation on a host machine” (software.intel.com) and is available for Mac, Windows, and Linux. HAXM can be download here: https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager

Follow the instructions at the Intel Website to get it installed and ready.

 

Start the Device

Once you have HAXM installed, open the Android Virtual Device Manager again and find your device. Click Start. Depending on your machine’s hardware, it may take a quick minute to start up.

To run an application in your emulator, simply open the Main Activity, and click on the Play button at the top of the Eclipse window and select “Run as Android Application.”

 

Voila!  You’re up and running with the Eclipse Android Emulator!

Eclipse Android Emulator

Eclipse Android Emulator running “Hello World!”

 

 

About Edward Skrod

Software engineer with two year’s experience programming in C++, 4 months of C, and 12 months experience programming in Java. I'm currently learning C#.