Learn Python


Click to Learn Python3

Saturday, July 30, 2011

How to Install APK Files on Android Emulator using command prompt (cmd) without eclipse

Here we are going to see how to run (install) the apk file to the Android emulator without using eclipse.

Installing in different OS:

1. a Windows, Mac OS X (intel) or Linux (i386) powered computer
2. the Android Software Development Kit (SDK).


You do not need Eclipse or Eclipse-plugin the Android Development Tools (ADT). The last two are required for the software development for Android, but are not necessary for application evaluation on emulator.

First download the Android SDK, which may be obtained here: http://code.google.com/android/download.html

Follow the instruction, described in the topic "Installing SDK" from the Google manual, which is located here: http://code.google.com/android/intro/installing.html#installingsdk or you can go with http://android-codes-examples.blogspot.com/search/label/installation

Steps need to be followed:

Installing the SDK

After downloading the SDK, unpack the .zip archive to a suitable location on your machine. For the rest of this document, we will refer to the directory where you installed the SDK as $SDK_ROOT.

Optionally, you can add $SDK_ROOT/tools and $SDK_ROOT/platform-tools to your path:

On Linux, edit your ~/.bash_profile or ~/.bashrc file. Look for a line that sets the PATH environment variable and add the full path to your $SDK_ROOT/tools to it. If you don't see a line setting the path, you can add one:

export PATH=${PATH}:
On a Mac, look in your home directory for .bash_profile and proceed as for Linux. You can create the .bash_profile, if you haven't already set one up on your machine.
On Windows, right click on My Computer, and select Properties. Under the Advanced tab, hit the Environment Variables button, and in the dialog that comes up, double-click on Path under System Variables, and add the full path to the tools/ directory under $SDK_ROOT to it.

Adding $SDK_ROOT/tools to your path lets you run Android Debug Bridge (adb) and the other command line tools without needing to supply the full path to the tools directory. Note that, if you update your SDK, you should remember to update your PATH settings to point to the new location, if different.


-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Now navigate to the $SDK_ROOT/tools directory and execute the file 'emulator.exe'. This is the Android emulator itself. Wait couple of minutes until it loads. Now you must see the home screen of Android - wallpapers with snowy mountains on the background and the navigation bar below.

Enjoyed? Ok! Let's continue. Download and save locally a APK-file which you want to install/evaluate on the emulator. We recommend to save the APK file directly in the $SDK_ROOT/tools directory.

Note: APK probably stands for "Android package". It's an application distribution unit in the Android environment. If you are coming from the Windows Mobile world, think of APK as of CAB-files.

Ok, now start the console ("Start -> Run... -> type 'cmd'" for Windows computers). Type-in the following command: adb install $APK where $APK is the name of the APK file. For example: adb install Snake.apk

If you receive a "path not found" error, then you probably either didn't add path to the $SDK_ROOT/tools directory to your system PATH settings or the application you are trying to install is not in the $SDK_ROOT/tools or $SDK_ROOT/platform-tools directory.

If all went without errors then you should be seeing your newly installed APK on the emulator.

4 comments: