Android Learning Route (ii) Create Android project

Source: Internet
Author: User
Tags android sdk manager

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
  1. Click New on the toolbar.
  2. 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.

  3. Complete the form in the window that appears:
    • The application name is the name of the app to show to the user. In this project, use "My first App" as the project name.

    • Project name is the directory of your project and the name of the project in Eclipse.
    • Packages Name is the package namespace for your project (follow the same package naming rules as Java programming). Your package name must be unique among all the package names in the Android system. So your best bet is to use the reverse of the domain name of your organization or publisher as the package name. In this project, you can use a package name similar to "Com.example.myfirstapp". However, you can no longer post apps with the package name "Com.example" on Google Play.
    • The Minimum Required SDK is the minimum Android version supported by your app, indicating the API level used. To support as many devices as possible, you should set it to the lowest available version that will provide the core functionality of your app. If some features in your app must use a higher version of the API and these features are not so important to the core functionality of your app, you can specify that these features run only on systems that support their version (as we did in supporting Different Platform As discussed in Versions). The default version is used for this project.
    • The Target SDK represents the highest version of the Android system you use to test your app (also using API level).

      Once a new version of the Android system is available, you should test your app on the new version and update the Taget SDK to the new version value to use the features of the newer platform.

    • Compile with indicates that you are going to use that version to compile your app. By default, it is set to the highest Android system version in your SDK (it must be Android4.1 or higher; If you do not have this version, you must install it through the SDK Manager). You can also support an older version of the system, but set target to the latest version to ensure that your app is optimized to have a great user experience on the latest version of the device.
    • Theme Specifies the UI style for your app. Here you can leave it blank.

    Click Next.

  4. Configure the project in this interface, all default here, then click Next.
  5. 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.

  6. Now you can choose an activity template to start creating your app.

    In this project, select blankactivity and click Next.

  7. 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:

  1. Change your directory to the bottom of the command line tools/ .
  2. 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.

  3. 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.


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.