Android Tutorial : How to Create Android App / Project

In my previous tutorial on Android, we leaned about first setting up the Android Development Environment and then we learned about improving the performance of virtual device so that we can development and test our code in faster way. In this tutorial, I am listing out steps you will be following to create an android app everytime. In between the steps, i will detailing out the details and some tips you will help you whenever you will be in doubt; hopefully.

The below sequential steps will create android app named DemoApp, using the dev setup as we created in my last post. Let’s start the fun.

Step #1: Creating the Android Project

From the Eclipse main menu, choose File > ‘Android Application Project’ and click “Next >” to proceed to the next page of the wizard.

File - Android Application Project
File – Android Application Project

This will bring you a blank wizard for creating new android application like below:

Blank New Android Application ScreenBlank New Android Application Screen
Blank New Android Application Screen

Here fill in the following items.

  • For “Application Name” and “Project Name”, fill in DemoApp
  • For “Package Name”, fill in com.howtodoinjava.demoapp
  • For “Minimum Required SDK”, choose “API 11: Android 3.0 (Honeycomb)”
  • For “Target SDK” and “Compile With”, choose “API 19: Android 4.4 (Kitkat)”
  • Choose Theme “Holo Dark”
Filled New Android Application Screen - Wizard One
Filled New Android Application Screen – Wizard One

Then, click “Next >” to move to the next page of the wizard:

Blank New Android Application Screen - Wizard Two
Blank New Android Application Screen – Wizard Two

Leave all options selected as default for now and click “Next”. At this step you will have to select the launcher icon for you app. All you have to select an image and wizard will do the rest like resizing it for different screen levels and storing them in appropriate places inside project. Cool !!

I have selected an image like below. You can choose any of your choice.

Android Create Launcher Icon
Android Create Launcher Icon

Now click Next. Here, you choose which template project you want to use as a starting point. Leave the “Create Activity” check-box checked, and choose “Blank Activity” from the template list.

Android Create Activity
Android Create Activity

Then, click “Next >” to move to the next page of the wizard and Fill in the following details:

  • For “Activity Name”, fill in DemoAppMainActivity
  • For “Layout Name”, fill in main
Android Fill Activity Details
Android Fill Activity Details

At this point, you can click the “Finish” button to complete the wizard. Your new DemoApp project should appear in the Eclipse Package Explorer view like below.

Project explorer view
Project explorer view

Step #2: Perform Some Minor Cleanup

The Android Developer Tools plugin will give you what it thinks are appropriate starting files for your app. Sometimes it is right, sometimes it is wrong. In our case, it may have added a library that we will not need to use directly, and we may as well get rid of that now.

Look in the libs/ directory of your project. If that directory exists, and it has a JAR in there (probably named android-support-v4.jar), delete it. However, leave the empty libs/ there.

Step #3: Running the Project

Now, we can confirm that our project is set up properly by running it on a device or emulator.

Press the Run toolbar button (usually depicted as a white “play” triangle in a green circle). The first time you run the project, you will see a “Run As” dialog, prompting you to declare how you want to run the app:

Project run as Android App
Project run as Android App

Click on “Android Application” and click “OK” to proceed.

At this point, if you have a compatible running emulator or device, the app will be installed and run on it. Otherwise, Eclipse will start up a suitable emulator, from the AVDs you created in the previous tutorial, then will install and run the app on it.

Android running app
Android running app

Note that you will have to unlock your device or emulator to actually see the app running — it will not unlock automatically for you.

In next tutorial, I will discuss about the contents inside the project created in some detail.

Happy Learning !!

Was this post helpful?

Join 7000+ Fellow Programmers

Subscribe to get new post notifications, industry updates, best practices, and much more. Directly into your inbox, for free.

1 thought on “Android Tutorial : How to Create Android App / Project”

  1. By reading this blog, I gain some confidence to built a small android app by the above mentioned methods. Before that, I was scared of development but now it seems easy to do.

    Reply

Leave a Comment

HowToDoInJava

A blog about Java and its related technologies, the best practices, algorithms, interview questions, scripting languages, and Python.