An Android project contains all the files, including the Android app code. The Android SDK tool provides default project directories and files to make it easy to create a project.
This course will show you how to create a new project through eclipse (including the ADT plugin) or by using the SDK tools at the command line.
tip: You must install the Android SDK first, and if you are using Eclipse, you must also install the ADT plugin (22.6.2 version or higher). If you don't have these, you can install them through the Android SDK Installation Wizard and then go back to this course.
Create a project from eclipse
- Click New on the toolbar.
- Open the Android folder on the pop-up window, select android Application Project, then click Next.
Figure 1. The New Android App Project Wizard in Eclipse.
- Complete the form in the window that appears:
Click Next.
- Configure the project in this interface, all default here, then click Next.
- This interface will help you create an icon for your app.
You can customize an icon in a variety of ways, and this tool can help you generate icons for all screen-resolution devices. You can customize a icon in several ways and the tool generates an icon for all screen densities. Before you publish your app, make sure your icon meets the specifications in the Image Design Guide (iconography).
Click Next.
- Now you can choose an activity template to start creating your app.
In this project, select blankactivity and click Next.
- Keep the details of all activity in the default state, then click Finish.
Your project is now a basic "Hello World" app and contains some default files. To run your app, go ahead and see the next lesson.
Creating a project from a command-line tool
If you are not using the Eclipse IDE with the ADT plugin, you can create your project by using the SDK tools at the command line:
- Change your directory to the bottom of the command line
tools/
.
- execute:
android list targets
This will list all of the available Android SDK platform versions that you have downloaded. Find a version that you want to use to compile your app. Remember the target ID. We recommend that you use the highest possible version. You can also support the old version of the system, but to set the target to the latest version to ensure that your app is optimized so that it can have a great user experience on the latest version of the device.
If no targets is listed, you need to download some by using the Android SDK Manager tool. See adding platforms and Packages.
- execute:
android Create Project--target <target-id>--name Myfirstapp--path < Path-to-workspace>/myfirstapp--activity mainactivity--package com.example.myfirstapp
will <target-id>
Replace with the ID remembered in the previous step, the same replacement < Path-to-workspace>
for the location where you want to save your Android project.
Your project is now a basic" Hello World "app and contains some default files. To run your app, go on to the next lesson ( next lesson).
tip: platform-tools/
tools/
Add and Catalog to PATH
environment variables.