With the growing usage of mobile devices, the need for mobile application development is on a rise. Besides, the development of an increasing number of Smartphones, tablet PCs and software platforms (like iOS, Windows Phone 7, etc.) is changing the mobile landscape, and creating opportunities for mobile developers to create apps for the expanding consumer base.
However, creating a mobile app can be overwhelming since it requires you to focus on several aspects. Which platform should you choose for app development? What kind of language you need to learn to build the app? What tools and resources are required for the mobile app project? and so on.
At present, Android operating system is, dominating the Smartphone market and is installed on various devices. Thus, creating an app for this OS can help you reach out to a wider audience base. The best aspect about Android is that it is an open-source platform and comes shipped with tons of free to use tools, and hence, can help you create a winning app without having to spend a dime. What’s more? Unlike the Apple’s app store, publishing an app on Android – Google Play Store is relatively easy.
In this tutorial, to help make the Android app development easier for you, we’ll be discussing about the process of creating an Android application using the Eclipse IDE.
First Things First: Why You Need Eclipse IDE for App Development
The Android SDK (Software Development Kit) provides several resources including tutorials, comprehensive documentation, tools and much more, helping developers to build Android-based apps. However, the SDK is missing features required for effective collaboration between a development team working on an Android project. To deal with such an issue, you just need to integrate the SDK with a compatible Eclipse based development solution.
Eclipse is a popular IDE (Integrated Development Environment) that together with ADT (Android Development Toolkit) plugin helps in building Android applications. More importantly, it provides an integrated development environment to carry out work on developing an Android app in a collaborative manner. The IDE can be used for designing, coding and testing your apps.
Another great benefit of using Eclipse is that it comes with lots of commercial products that can be integrated with the Android SDK, and helps in providing development teams with a lot more capabilities. For instance, since understanding the actual application structure can be challenging when working on a medium-size project, you can give the collaborative development team the ability to make create a model from the real source code of an app and so on.
Prepare to Get Eclipse and Android SDK Installed
The first thing you need to focus on is installation of Eclipse, as well as, the Android SDK using the following steps:
Step 1 – First off, you’ll need to download the Android SDK for a specific platform – be it Windows, Linux or any other.
Step 2 – Unzip the downloaded files and save them to some place that’s easy to remember (on your hard drive).
Step 3 – Make sure that the Eclipse IDE is installed on your system. If not, then get the “Eclipse IDE for Java Developers package” downloaded and installed.
Step 4 – Next, open up Eclipse and hover Help → Install New Software. This will open up the following window:
Step 5 – Now click on the Add button (as shown in the image above) for adding the “ADT Plugin”:
Step 6 – Next, choose the ADT Plugin option from the “Work with” drop down menu with a list of items. Select all those items and click on Next, and then tap Finish for installing the plugin. After getting all the things installed, you’ll have to restart Eclipse.
Step 7 – As soon as the Eclipse IDE restarts, navigate to Window → Preferences, and you’ll be able to view ‘Android’ listed as one of the categories.
Step 8 – Now, you will have to tell Eclipse about the location where the Android SDK has been installed (such as C:\Program Files\Android\android-sdk). For this, click on the Android category and then Browse to search for the location where all the SDK files have been extracted.
Begin With Creating a New Android Project
Once you’ve set up the environment (i.e. Eclipse and ADT plugin) for building your Android app, follow the below steps to begin creating your application:
Step 1 – Click on File → New → Project, and then choose the “Android Application Project” from the Eclipse’s wizard list.
Step 2 – When you click on the “Android Application Project” a dialog box named New Android Project will open.
Step 3 – Let’s say, you want to create a simple application named “Hello World”. To do so, you’ll first have to assign your project name as Hello_World. And then, select the Android version you want to work on (in our case, we’re selecting version 2.2). Next, we will have to enter the API Version in the “Min SDK Version” box. Besides this, you’ll also have to enter an application name.
Finally, enter your project’s package that will act as an identifier for your app. This identifier will help you in tracking your app updates from the Android Market, and thus it is important that your identifier must be unique.
After entering all the details, click Finish, and Eclipse will create your Android project that you can run.
Running Your New Android Project
Now, it’s time to run your app in Eclipse. Since, this is your first app, Eclipse will ask you to about the project type you’re working on:
Step 1 – Select Run option or press “Ctrl+F11” keyboard shortcut.
Step 2 – Next, click on your Android Application and hit OK.
Eclipse will make your app run on an Android device. Since, you don’t have any Android devices at the moment, so the attempt to run your application will fail. And you will be prompted to add a new “Android Virtual Device” (AVD):
Make sure to create an AVD, if you would like to test how your app functions.
Creating Android Virtual Devices
One of the popular emulator, Android Virtual Device (AVD) helps in simulating a real-world Android device, which can be a Smartphone or a tablet. Essentially, AVD is used for testing the performance of apps on Android devices. This saves you from buying a new gadget that is being launched in the market to test your app. You can create numerous AVDs and set them up with different Android versions. In fact, you can even choose to configure several hardware properties for each of your AVD (like camera resolution, a keyboard, etc.).
So, let us now view the steps to create your very first Android Virtual Device:
Step 1 – Make sure to run your app first, and if you receive a warning asking to add an AVD, simply click on “Yes”.
Step 2 – From your Android SDK window, click New and the AVD Manager dialog box will open up. In this box, you’ll have to enter the following details:
Target: Android 2.2 – API Level 8
SD Card Size: 2000 MiB
Skin Built In: Default (HVGA)
Step 3 – Click on “Create AVD” option for building a new AVD.
Step 4 – Finally, close the AVD Manager dialog. Next, click on the “Apply” button to exit from the configurations window. And now, you can run your Android app.
The purpose of this tutorial is to help you learn about the basic process of building Android apps. Reading the tutorial will help you understand the basics of working on Eclipse. However, you will need to write code to add advanced features into your application. And remember that each platform comes with some design challenges. So, when creating an app keep in mind to develop a solution that doesn’t impact much on the processing power and memory of the device.
There are several other key aspects that you need to consider when building an Android application, but before you need to learn the basics of how you can build your first Android app.