Building and Running an Android Application

Note: Check the parent post here.

In this stage, we shall build, test, and deploy the Hello World application on the emulator. We will use an emulator, as we do not have an actual Android device.

Step 1 – Building and Running the Application

All developed applications must be signed before they are run on an emulator or device. As we do not intend to publish our application, we will sign it in debug mode. This is done for us by the Ant build script.

To create the .apk file, navigate to the root of your project directory and issue the command -

If the build is successful, then this step creates the debug .apk file inside the project bin/ directory as _debug.apk, in our case MyAndroidApp-debug.apk. In case of any errors, please resolve them before proceeding further.

Step 2 – Deploying the Application on the Emulator

To run the application on the emulator, we need to install it on the emulator. If there is more than one instance of the emulator, we can select the emulator on which we want to install our application.

To find the list of the emulator instances, execute the command adb devices

To install the application on the emulator, issue the command -

This installs the .apk file on the emulator as can be seen in the illustrations below.