Click here to Skip to main content
15,889,200 members
Articles / Mobile Apps / Android
Tip/Trick

Running Android Apps on Emulator

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
26 Nov 2012CPOL3 min read 17.4K   12  
This article demonstrates running Android applications on emulator.

Sample Image

Sample Image

Introduction

This is basically a non-programming article in which I am describing how to install Android apps on an emulator.

Many times we come across situations when we cannot run a much liked Android application on a device. Either we do not have a device to test our application, or we do not have space to install the application on our device, or simply we want to test an application before installing it on our device. In such cases, the emulator provided by the Android SDK comes to the rescue.

In this article, I will show how to create an SD card to be used by the Android emulator, how to mount the SD card and copy applications to the SD card. Once the app is copied to the emulator, it can be installed in the same way as installing on a real device. I am assuming here that the Android SDK has been installed on the computer.

As an example, I am showing how to install the AngryBirds game on the emulator.

Background

First we have to create an SD card to be used by the emulator. For this, navigate to the "tools" directory of your Android SDK installation on the command prompt and type the following command:

mksdcard -l MYSDCARD 2000M F:\Software\android\mysdcard.img

Image 3

The above command creates an SD card called mysdcard.img with a capacity of 2GB. The -l option specifies the label for the SD card.

After that we need to load the SD card while starting the emulator. For this, the following command can be used:

emulator -sdcard F:\Software\Android\mysdcard.img -avd MyDevice -scale 0.75

Image 4

In the above command, the -sdcard option specifies the path of the SD card, the -avd option specifies the virtual device, and the -scale option specifies the relative size to scale the emulator.

The emulator starts as follows:

Image 5

Next we have to copy the required apps to the SD card. For this, navigate to the "platform-tools" directory of the Android SDK, while the emulator is running, and type the following commands, replacing the file names with file names of your choice:

adb push F:\AndExplorer.apk sdcard/
adb push F:\AngryBirdsRio.apk sdcard/

Note: The / at the end of SD card is mandatory.

Image 6

Image 7

I prefer to install a file manager (e.g., AndExplorer.apk) before other apps so that installing other apps becomes easier by navigating to the SD card using the file manager.

Once the required files are copied to the SD card, we must install the file manager. Now the question is how to install the file manager itself without being able to browse to the SD card. The solution is to start the internet browser and type the following in the address bar:

file:///sdcard/AndExplorer.apk

The following screen appears:

Image 8

Clicking the Install button will install the AndExplorer app. If we now browse the installed apps on the device, we get the following screen:

Image 9

Now we can use the AndExplorer app to navigate to the SD card and view the contents as follows:

Image 10

Clicking on the AngryBirdsRio.apk file will show the following screen:

Image 11

Clicking the Install button will install the AngryBirds app and it will be listed in the installed apps as follows:

Image 12

The following screens show the game in action on the emulator: (You can press the Ctrl-F12 key combination on your computer to change the orientation of the emulator).

Image 13

Image 14

Points of Interest

The android emulator provides an excellent environment to test apps before deploying them to the device. Hopefully this discussion will be useful to readers.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Instructor / Trainer NIIT, India
India India
I am a trainer by profession. Currently I am working with iFuture Technologies(India) as a Senior Faculty. I enjoy programming as a hobby. During my career I have seen the growth and decline of many technologies, many of them being my favorites like Flash, WPF, Windows Mobile Development. Few of my current favorites are Android, Xamarin and Python, though I also like traditional and evergreen languages like PHP, C#, Visual Basic and Java.

Apart from computers, my favorite pastime is bicycling.

Comments and Discussions

 
-- There are no messages in this forum --