Creating an android Project

Source: Internet
Author: User

An android project contains all the files that comprise the source code for your Android app. The Android SDK tools make it easy to start a new Android project with a set of default project directories and files.

This lesson shows how to create a new project either using eclipse (with the ADT plugin) or using the SDK tools from a command line.

Note:You shoshould already have the android SDK installed, and if you're using eclipse, you shoshould also have
ADT plugin installed (version 255.0.0 or higher). If you don't have these, follow the Guide
Installing the android SDK before you start this lesson.

Create a project with eclipse
  1. In eclipse, click new Android app project in the toolbar. (If you don't see this button, then you have not installed the ADT Plugin-see
    Installing the eclipse plugin .)

  2. Fill in the form that appears:
    • Application nameIs the app name that appears to users. For this project, use "My first app ."

    • Project nameIs the name of your project directory and the name visible in eclipse.
    • Package nameIs the package namespace for your app (following the same rules as packages in the Java programming language ). your package name must be unique guest SS all packages installed on the Android system. for this reason, it's generally best
      If you use a name that begins with the Reverse Domain Name of your organization or publisher entity. for this project, you can use something like "com. example. myfirstapp. "However, you cannot publish your app on Google Play using the" com. example "namespace.
    • Build SDKIs the platform version against which you will compile your app. by default, this is set to the latest version of Android available in your SDK. (It shoshould be Android 4.1 or greater; if you don't have such a version available, you must
      Install one using the SDK manager ). you can still build your app to support older versions, but setting the build target to the latest version allows you to enable new features and optimize your app for a great user experience on the latest
      Devices.
    • Minimum Required SDKIs the lowest version of Android that your app supports. to support as your devices as possible, you shoshould set this to the lowest version available that allows your app to provide its core feature set. if any feature of your
      APP is possible only on newer versions of Android and it's not critical to the app's core feature set, you can enable the feature only when running on the versions that support it.

      Leave this set to the default value for this project.

    ClickNext.

  3. The following screen provides tools to help you create a launcher icon for your app.

    You can customize an icon in several ways and the tool generates an icon for all screen densities. Before you publish your app, you shocould be sure your icon meets the specifications defined in
    Iconography design guide.

    ClickNext.

  4. Now you can select an activity template from which to begin building your app.

    For this project, selectBlankactivityAnd clickNext.

  5. Leave all the details for the activity in their default state and click
    Finish
    .

Your android project is now set up with some default files and you're ready to begin building the app. Continue to
Next lesson.

Create a project with command line tools

If you're not using the Eclipse IDE with the ADT plugin, You can instead create your project using the SDK tools from a command line:

  1. Change directories into the android SDK'stools/Path.
  2. Execute:
    android list targets

    This prints a list of the available Android platforms that you 've downloaded for your SDK. find the Platform against which you want to compile your app. make a note of the target ID. we recommend that you select the highest version possible. you can still
    Build your app to support older versions, but setting the build target to the latest version allows you to optimize your app for the latest devices.

    If you don't see any targets listed, you need to install some 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 an ID from the list of targets (from the previous step) and replace
    <path-to-workspace>With the location in which you want to save your android projects.

Your android project is now set up with several default deployments and you're ready to begin building the app. Continue to
Next lesson.

Tip:Addplatform-tools/As well as
tools/Directory to yourPATHEnvironment variable.

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.