Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts

Installing APK into Android Emulator/Devices

Directing Commands to a Specific Emulator/Device Instance

If multiple emulator/device instances are running, you need to specify a target instance when issuing adb commands. To so so, use the -s option in the commands. The usage for the -s option is:
adb -s <serialNumber> <command> 
As shown, you specify the target instance for a command using its adb-assigned serial number. You can use the devices command to obtain the serial numbers of running emulator/device instances.
Here is an example:
adb -s emulator-5556 install helloWorld.apk
Note that, if you issue a command without specifying a target emulator/device instance using -s, adb generates an error.

Installing an Application

You can use adb to copy an application from your development computer and install it on an emulator/device instance. To do so, use the install command. With the command, you must specify the path to the .apk file that you want to install:
adb install <path_to_apk>
Note that, if you are using the Eclipse IDE and have the ADT plugin 
installed, you do not need to use adb (or aapt) directly to install your
application on the emulator/device. Instead, the ADT plugin handles the
packaging and installation of the application for you. 

Querying for Android Emulator/Device Instances

 Before issuing adb commands, it is helpful to know what emulator/device instances are connected to the adb server. You can generate a list of attached emulators/devices using the devices command:

adb devices

In response, adb prints this status information for each instance:
  • Serial number — A string created by adb to uniquely identify an emulator/device instance by its console port number. The format of the serial number is -. Here's an example serial number: emulator-5554
  • State — The connection state of the instance. Three states are supported:
    • offline — the instance is not connected to adb or is not responding.
    • device — the instance is now connected to the adb server. Note that this state does not imply that the Android system is fully booted and operational, since the instance connects to adb while the system is still booting. However, after boot-up, this is the normal operational state of an emulator/device instance.
The output for each instance is formatted like this:
[serialNumber] [state]

Develop First App in Android

1. Android SDK Kit
You can get the latest version of the SDK starter package from the SDK download page. Make sure to download the package that is appropriate for your development computer.

2. Installing the ADT Plugin for Eclipse
Follow instruction mentioned at Eclipse ADT Installation and Configuration

3. Launching the Android SDK and AVD Manager
The Android SDK and AVD Manager is the tool that you use to install and upgrade SDK components in your development environment.

You can access the tool in any of three ways:

    * If you are developing in the Eclipse IDE with the ADT Plugin, you can access the tool directly from the Eclipse UI.
    * On Windows only, you can launch he tool by double-clicking a script file.
    * In all environments, you can access the tool from a command line.

Launching from Eclipse/ADT