Click here to Skip to main content
Click here to Skip to main content

Tagged as

Running Android Apps on Emulator

, 26 Nov 2012 CPOL
Rate this:
Please Sign up or sign in to vote.
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

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

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:

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.

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:

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

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

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

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

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).

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)

Share

About the Author

Azim Zahir
Instructor / Trainer NIIT, India
India India
I am a trainer by profession. Currently I am working with NIIT (Mumbai, India) as a Senior Faculty. I enjoy programming as a hobby. My favorite technologies are Flash, Flex and Silverlight.
 
Of late I have developed keen interest in WPF and Windows Mobile programming.
 
Apart from computers, my favorite pastime is bicycling.

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.1411028.1 | Last Updated 26 Nov 2012
Article Copyright 2012 by Azim Zahir
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid