Android Training-create an Android Project

Source: Internet
Author: User

An Android project contains all the code files. The Android SDK tool helps us easily create an Android project, which contains default folders and files.

This course teaches us how to use Eclipse to create a project, or use the SDK tool to create a project through command line.

Tip: You must have installed the SDK. If you use eclipse, you must have installed the ADT plug-in. If not, you need to take a look at the Installing the Android SDK tutorial.

Use eclipse to create a project

1. Click this icon in the toolbar to create a new project. If you do not have this icon, it means that you have not installed the ADT plug-in. If you do not know how to install it, see Installing the Eclipse Plugin.

2. Fill in the pop-up form:
A. Application Name is the Name of the program displayed to the user. We use "My First App" for this project ".

B. The Project Name is the Name of the Project directory, which is displayed in eclipse.

C. Package Name is the Package Name, which must be unique in the Android system. Therefore, a good solution is to write your domain name backwards. Here, we use the package name "com. example. myfirstapp ". Of course, you cannot use the name "com. example" to publish your program to Google Play.

D. Build SDK is the platform version of your program. The default setting is the latest version of your available SDK. (The version is 4.1 or later. If no version is available, you need to install it using SDK Manager ). You can also use the old version, but the latest version allows you to use more new features and optimize your user experience.

E. Minimum Required SDK is the lowest version supported by your program. To support as many devices as possible, you should set it to the lowest version, which can implement the core functions of your program. If some features of your program require the latest version, but this feature is not the core feature, you can enable these features on devices that support the latest features.

Use the default value for the remaining settings. Click Next.

 

3. The following interface provides a tool for you to create an icon when the application starts.

You can customize your icons. This tool will generate an icon for all screen density. Before you release your program, make sure that your icons comply with the rules defined in the Iconography design guide.

Click Next.

4. Now you can select an activity template to create your application. Here, we select "BlankActivity" and then "Next.

5. Keep all the remaining details about the activity by default. Select Finish.

Your Android project has been created and contains some default files. Now you are ready to build the application.

Use the command line tool to create a project
If you do not use the Eclipse IDE with the ADT plug-in, you can use the command line to call the SDK tool to create a project:

1. Go to the tools/path of the Android SDK.

2. Execute:
Android list targets

This command prints the available Android platform version you downloaded. Find the platform you want to use. Write down the target id. We recommend that you use the highest version. You can also use a lower version, but the new version allows you to optimize your program on the latest device.

If you do not see any list, you need to install it using the Android SDK Manager tool. See Adding Platforms and Packages.

3. Execute:
Android create project -- target <target-id> -- name MyFirstApp \
-- Path <path-to-workspace>/MyFirstApp -- activity MainActivity \
-- Package com. example. myfirstapp

Replace <target-id> with the id you noted down earlier, and replace <path-to-workspace> with the directory of the project you want to save.

Now your project contains some default files and configurations, And the preparation is complete.


Author: lixiang0522

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.