[Android] build Android app based on Linux command line (i): About Android Project

Source: Internet
Author: User
Tags version control system

About Android Projects

A project is a container for saving source code and resource files.

The Android SDK tools provided by Google can only be compiled and packaged for projects with a fixed directory structure. It is therefore highly recommended to create an Android project using Eclipse + ADT or Android commands.

You can use Eclipse + ADT to create three projects that have the same main structure but different functions, namely Android Projects, Test Projects, and Library Projects. This article focuses on Android Projects.

An Android project can be seen as a complete container that contains the source code of the application, resource files, and other things such as Ant build files and Android Manifest files. )。 All of these files are eventually built into an. apk file that can be installed on an Android device.

Eclipse + ADT automatically creates the basic directories and files needed for an Android project, but you can create more directories and files in your project based on your actual needs.

Android Projects

An Android project is a project that can eventually be compiled into an. apk file that runs on an Android device. It contains the application source code and resource files, a subset of directories and files are automatically generated, and the other part can be created as needed.

The following is a basic directory and file for an Android project:

  src/

This directory is used to save the Activity file and all source code files (. java and. aidl files). The Activity file save path is Src/your/package/namespace/activityname.java.

  

  bin/

This directory is used to save the build results. Here you can find the final. apk file and other compiled resources.

  

  jni/

This directory is used to save source code files developed using the Android NDK. See the Android NDK documentation for more details.

  gen/

This directory is used to save ADT-generated Java files, such as R.java and interface files generated from the Aidl file.

  assets/

This directory is used to save the original files, which are compiled as-is into the. apk file, and the file name is also left intact. You can use Assetmanager to read these files. It is ideal for saving game data and more.

  res/

This directory holds the application's resource files, such as drag-and-drop images, layout files, and string values. See Application Resources for more details.

    anim/

This directory is used to save the XML file that will be compiled into an animation object. See Animation.

    color/

This directory is used to save the XML file that describes the color. See Color Values.

    drawable/

This directory is used to save and drag images related to files, including bitmap files (PNG, JPEG, GIF), 9-patch picture files, and XML files for describing drawable objects. See drawable.

    layout/

This directory is used to save the XML file that describes the layout of the screen. See Layout.

    menu/

This directory is used to save the XML file that describes the application menu. See Menus.

    raw/

This directory is used to save any original files, raw/and asset/are only accessed in different ways. The files in this directory are processed by AAPT and must be referenced in the R class using the resource identifier. This directory is suitable for storing media files, such as MP3 or OGG files.

    values/

This directory is used to save XML files that are compiled into other resources. Unlike res/, resources that are described in XML under this directory cannot be referenced by file names. The element type in the XML file is responsible for controlling the location of the resource in the R class.

    xml/

This directory is used to save the XML file that describes the configuration of the application component. For example, an XML file can define Preferencescreen,appwidgetproviderinfo or searchability Metadata. See Application Resources.

  libs/

This directory is used to save private Java library files.

  Androidmanifest.xml

The file describes the properties of the application and its individual components. For example, the nature of activities,services,intent receivers and content providers, what permissions the application requires, what external library files are required, what features are required for the device, support API levels, and so on. See Androidmanifest.xml.

  Project.Properties

This file is used to save project settings, such as build targets. The file should be included in the version control system as part of the project. To edit the file, you can right-click the project folder in Eclipse and select Properties.

  Local.properties

This file is used to save custom build properties for a specific computer. If you use ANT to build your project, the file needs to include the SDK installation path. The file should not be included in the version control system. If you use Eclipse, the file can be ignored.

  Ant.properties

This file is used to save the custom properties of the build system. You can edit the file to overwrite the default build settings that Ant uses, and you can also specify the KeyStore file path and key aliasin the file, so that when you build your app in release mode, the build tool can automatically sign your app. This file is part of the entire project and should be included in the version control system. If you build with Eclipse, the file can be ignored.

  Build.xml

The file is an Ant build file. Useful only when you use ANT to build your project.

Report:

1. [Android Developer] Managing Projects

[Android] build Android app based on Linux command line (i): About Android Project

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.