Keshav BahadoorAn basic guide to setting up and building native Android applications
Table of Contents
1. Terms and Definitions...3
2. Overview ...3
3. Setting up...3
3.1 Installing the Java JDK ...3
3.2 Installing the Android ADT Bundle...4
3.3 Setting up the Android Development Environment ...4
3.3.1 Select the Workspace ...5
3.3.2 Welcome Screen ...5
3.3.3 Eclipse overview...6
4. Running Example Android Applications...8
4.1 Importing existing Android projects into Eclipse...8
4.2 Setting up the Android Emulator...12
4.3 Running a Project...16
1. Terms and Definitions
This section presents some common technological jargon and their explanations.
Native Application An application that is made to run on solely on a particular operating system, such as Android or iOS.
Application The software or product that is created to run on mobile devices or computers.
Cross platform The idea of writing code once and having it work across all platforms or operating systems / devices.
IDE Integrated Development Environment
SDK Software Development Kit
Android applications can be created in the following ways:
1. Programming the application specifically for Android devices using the Android SDK (Software Development Kit) and a development environment such as Eclipse.
2. Using an app building tool such as App Inventor (insert link).
3. Programming a solution that works across all platforms or devices, using a cross platform tools (PhoneGap, LibGDX, etc).
This document will focus on the first way of creating Android applications.
3. Setting up
This section provides a guide to install and setup the software required for building Android applications.
To find out if your Windows computer is 32bit or 64bit:
Right click on My Computer then select Properties. The version should be displayed here.
3.2 Installing the Android ADT Bundle
The android ADT or Android Development Tools bundle is an integrated development environment for the use creation of Android applications. It is a customized version of the Eclipse Integrated
Development Environment (IDE). Note on Eclipse
Eclipse IDE is a tool that allows you to create various types of Java based applications, including Android applications. It facilitates the creation of projects, adding and deleting of files to the projects, and the editing of code.
The ADT Bundle can be downloaded at: http://developer.android.com/sdk/index.html
Ensure that you download the correct version of the ADT Bundle (32 bit or 64 bit).
After downloading the ADT bundle, it will need to be extracted. This can be done by using winzip, winrar, or 7-zip.
You can download 7-zip from here: http://www.7-zip.org/download.html
3.3 Setting up the Android Development Environment
3.3.1 Select the Workspace
When launched, Eclipse will then ask you to select a workspace. The workspace is a location on your computer that Eclipse will use to store all your projects and applications.
You can leave the default workspace that Eclipse suggests.
You may also select the option “Use this as the default and do not ask again”. This option tells Eclipse that you will be working with that location always.
Note that you can change the workspace at anytime if you wish. Click the OK button to start Eclipse.
3.3.2 Welcome Screen
You may read the welcome note, and then click the close button to proceed.
3.3.3 Eclipse overview
The following is an overview of the main windows of the Eclipse environment. Click close button to
Shows your current packages, projects or applications that you are working on. Code Area
Area to edit code files. Console
This area displays to the user output, warnings and other messages. Memory Usage
Displays the amount of memory Eclipse is currently using. Package
4. Running Example Android Applications
You can visit the following website to download the android application examples that were covered during the workshop.
4.1 Importing existing Android projects into Eclipse
Download the Anroid Application Examples zip file, and extract the contents to your computer. You may use winzip, winrar or 7-zip to extract the files.
Now, open Eclipse if not already opened.
Click File from the top menu bar, and then select the Import menu option.
Click on the Next button to proceed.
In the resulting dialog window, click the Browse button next to “Select root directory”.
Click on the OK button.
Ensure that both projects are checked. If they are not checked, click the checkbox next to the projects. Next, ensure that the “Copy projects into workspace” option is checked. This option instructs Eclipse to copy the projects into the workspace. If this is not selected, Eclipse will use the projects from the location specified earlier.
4.2 Setting up the Android Emulator
The Android emulator allows you to emulate an Android device on the computer. This enables you to test or debug Android applications without using a physical Android mobile handset.
The main disadvantage of the Android emulator is that it performs much slower than a physical Android device.
The Android emulator can be setup as follows.
Click Window from the top menu options then select Android Virtual Device Manager (also referred to as the AVD Manager).
In this dialog box, you must give the Android virtual device a name. Type the name you want in the AVD
Name field. In this example the name “AndroidEMU” was used.
Next, a Device should be specified. This is the virtual android mobile device that the AVD manager will create for you. It is based on some common screen sizes available to consumers.
Target sets the version of the Android Operating system you wish you emulate. For now you will leave
To run the Android virtual device, select it from the AVD list, then click the “Start..” button. A window that resembles an android mobile smart phone will appear.
It is common for the Android virtual device to take a couple minutes to start.
4.3 Running a Project
A project present in the Package Explorer of Eclipse.
You can run projects by right clicking on the required project from the Package Explorer, then selecting
5. Further Reading
The following is a great video resource on building Android applications using the Java programming language. It is aimed at beginners. Although some things may be outdated, I highly recommend using these videos.