Android Development self-study Notes (II): Engineering Document Analysis _android

Source: Internet
Author: User

No matter what IDE you use to develop Android, integrate the official Android SDK and create Android projects, the project will default to include a complete set of Android project files, which can be run directly on your real machine or simulator.

This article is a simple analysis of this default complete set of project engineering file structure, so that we develop our own projects can be skilled to achieve targeted.

Androidmanifest.xml

The Androidmanifest.xml file is the Soul architect of the entire Android project, which defines the features you need to run your Android program, as well as define the permissions required for the Android program and the core Android components.

Here is a brief introduction to:<uses-sdk>, one of the most important node elements we have ever encountered.

This node defines the device compatibility issues for your application, and we all know that Android devices are all kinds of things, but different devices have Android versions, like the Android2.2 we've often heard about, 2.3, tablet-specific Android3.0 and now android4.x, these editions have well-defined sdkversion, where we have to specify the smallest Android version (Android: Minsdkversion) and the target Android version (Android:targetsdkversion) are two properties. So it should be shaped like this:

Copy Code code as follows:

<manifest xmlns:android= "Http://schemas.android.com/apk/res/android" ... >
<USES-SDK android:minsdkversion= "8" android:targetsdkversion= "/>"
...
</manifest>

Where the minimum version of Android is specified as 8 and the target version is 19, it should be noted that:

The 1.android:targetsdkversion should be set as high as possible, and this property is useful when the device's SDK version and the specified target version are the same, without the device opening compatibility feature;

2.android:minsdkversion This property then shows you how backward the application is, and once the Device SDK version is below this number, the following error cannot be installed:

Copy Code code as follows:

Installing Com.example.HelloWorld
DEVICE SHELL command:pm install-r "/data/local/tmp/com.example.helloworld"
PKG:/data/local/tmp/com.example.helloworld
Failure [INSTALL_FAILED_OLDER_SDK]

1. If you do not explicitly specify Targetsdkversion, the default is equivalent to Minsdkversion;
2. In addition, we sometimes see android:maxsdkversion, whose role is the opposite of Minsdkversion, which is mainly embodied in Android 1.5, 1.6, 2.0, And 2.0.1, these old systems will reproduce the validation and install the applications installed in the old system once they have completed the system update, and the new system does not install these applications once the maxsdkversion is found to be lower than the upgraded new system.

src/

SRC directory, as the name implies that the application of the source code file, of course, after compiling this directory will no longer exist, otherwise the source code was stolen by others?

res/

The Res directory refers to the directory where the resource file resource, which contains subdirectories.

For example, the directory drawable-xxx of the picture, in the current default environment, there are generally 4 similar directories, respectively, to store different resolution of the picture (DRAWABLE-XHDPI/HDPI/MDPI/LDPI), Good application in order to fit as many different resolutions of the model, it is necessary to do multiple sets of different resolution pictures, and stored in these 4 directories.

The Res directory also contains layout files for defining user interface GUI (application interface), which are stored in the layout directory;

There is also a directory that holds the XML that defines the set of variables, values, which can define a set of variables such as color and string.

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.