Getting started with Android SDK

Android is an operating system designed for mobile phones and tablets. It is developed for a consortium of hardware, software and telecommunications companies leaded by Google. Nowadays it is the most-used smartphone platform worldwide with more apps developed, whereas iOS from Apple is the platform with more app downloads.

The programming language used to develop Android applications is Java and the most used IDE is Eclipse. The Android SDK provides all the tools and API libraries to build, test and debug the Android apps. In this post I will try to show you how to build your first Android app.

1. Installing the Android SDK

The first step consists on download and install the Android SDK. Once installed, you can download the packages from the Android SDK Manager.

2. Adding Platforms and Packages

The Android SDK Manager allows to download the platforms and tools, which are needed to develop an Android app. Available packages on the SDK Manager are: tools for debugging and testing apps, documentation for the Android platform APIs, the SDK platform and system images for each version of Android, a collection of samples, the Google APIs and the support libraries.

To download the platforms, tools and components, launch the SDK Manager and when it opens click Install to install the recommended packages into your Android SDK Environment.

3. Installing the ADT Plugin for Eclipse

The Eclipse IDE for Java Developers contains what you need to build Java applications but you can also use any other IDE for Java. However, if you use Eclipse you have to install the ADT Plugin. It extends the capabilities of Eclipse to build Android apps with UI interfaces and using Android Framework packages.

To install the ADT Plugin on Eclipse: Help > Install New Software, click on Add buttonand add the repository from the following URL location

https://dl-ssl.google.com/android/eclipse/)

Once the installation completes, restore Eclipse.

4. Creating an Android Project

Open Eclipse and click on New > Project > Android Project.  Firstly you have to set the Application Name (name that appears to users), Project Name (name of your project visible in Eclipse), Package Name (package namespace for your app), the SDK version against which you will compile your app and the minimum SDK required. The following screens provides tools to create a launcher icon for the app and templates from which begin building the app.

 

5. The Android Project

The Android project created includes a default set of “Hello World” source files:

  • src/ Directory for the app’s main source files coded in Java.
  • res/ Directory which contains app resources:
    • drawable/ Drawable objects such as bitmaps.
    • layout/ Files that define the user interface.
    • values/ XML files that contains a collection of resources (strings, color definitions…)
  • Androidmanifest.xml Define all components of the app and describes the fundamental characteristics.

5. Running the app

You can install and run the app on an Android device or on the emulator.

5.1 Run on a real device

Plug in your Android device on the computer with the USB cable to run the app on the device. You might need to install the USB driver. Once installed enable USB debugging on the device on Settings > Developer Options.

To run the app from Eclipse, click the Run button from the toolbar. The app will be automatically installed and it will start running on the device.

5.2 Run On the emulator

To run the app on the emulator an Android Virtual Device (AVD) has to be created. Launch the Android Virtual Device Manager click New, get it a name, a platform target, a SD card size and create the AVD. 

To run the app from Eclipse, click the Run button from the toolbar. The app will be automatically installed and it will start running on the AVD.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s