Creating an Android Project

The ADT plugin provides a New Project Wizard that you can use to quickly create a new Android project (or a project from existing code). To create a new project:

2. Select Android > Android Project, and click Next.

3. Select the contents for the project:

o Enter a Project Name. This will be the name of the folder where your project is created. o Under Contents, select Create new project in workspace. Select your project workspace location.

o Under Target, select an Android target to be used as the project's Build Target. The Build Target specifies which Android platform you'd like your application built against.

Unless you know that you'll be using new APIs introduced in the latest SDK, you should select a target with the lowest platform version possible, such as Android 1.1.

Note: You can change your the Build Target for your project at any time: Right-click the project in the Package Explorer, select Properties, select Android and then check the desired Project Target. o Under Properties, fill in all necessary fields.

■ Enter an Application name. This is the human-readable title for your application — the name that will appear on the Android device.

■ Enter a Package name. This is the package namespace (following the same rules as for packages in the Java programming language) where all your source code will reside.

■ Select Create Activity (optional, of course, but common) and enter a name for your main Activity class.

■ Enter a Min SDK Version. This is an integer that indicates the minimum API Level required to properly run your application. Entering this here automatically sets the minSdkVersionattribute in the <uses-sdk> of your Android Manifest file. If you're unsure of the appropriate API Level to use, copy the API Level listed for the Build Target you selected in the Target tab.

4. Click Finish.

Tip: You can also start the New Project Wizard from the New icon in the toolbar.

Once you complete the New Project Wizard, ADT creates the following folders and files in your new project:

src/

gen/

This contains the Java files generated by ADT, such as your R.java file and interfaces created from AIDL files.

assets/

This is empty. You can use it to store raw asset files. See Resources and Assets.

res/

A folder for your application resources, such as drawable files, layout files, string values, etc. See Resources and Assets.

AndroidManifest.xml

The Android Manifest for your project. See The AndroidManifest.xml File.

default.properties

This file contains project settings, such as the build target. This files is integral to the project, as such, it should be maintained in a Source Revision Control system. It should never be edited manually — to edit project properties, right-click the project folder and select "Properties".

0 0

Post a comment