Installing an android app in the emulator

If you try to install an android app ( .apk file) in the android emulator, it should not be a problem, when doing so with a vanilla install of the android SDK.
Here’s a fine walkthrough

However, if you’ve been developing for various android SDK versions, you’ll have defined multiple AVD’s (Android Virtual Devices) to test your stuff and when trying to install an .apk file with:

adb install path/to/<filename>.apk

ADB (Android Debug Bridge) will be complaining about not having specified which AVD to install it on.

The solution is to first start the emulator with the AVD you wish to use

emulator -avd <AVD name>

With <AVD name> being the same name you gave to that specific AVD in the ‘Android SDK and AVD Manager’.
Next, when the device is running, you need to tell the ADB to install the .apk file specifically for the emulator instance.

You can get a list of currently running AVD’s with

adb devices

In my case it returned

List of devices attached
emulator-5554 device

Now, to install the .apk file specifically for that AVD instance you have to specify it with the -s option

adb -s emulator-5554 install /path/to/<filename>.apk

Now it should install w/o any problems

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: