The role of Androidmanifest. xml in the Android project, androidmanifest

Source: Internet
Author: User

The role of Androidmanifest. xml in the Android project, androidmanifest

The AndroidManifest. xml file in a project is as follows:

<? Xml version = "1.0" encoding = "UTF-8"?>
<Manifest xmlns: android = "http://schemas.android.com/apk/res/android"
Package = "tw. suggest" // specify the package path of the program file in the project.
Android: versionCode = "1" // version number of this project
Android: versionName = "1.0"> // version name of the project


<Uses-sdk
Android: minSdkVersion = "1" // The lowest API version available for this project
Android: targetSdkVersion = "10"/> // The expected API version of this project
<Application
Android: allowBackup = "true" // backup allowed
Android: icon = "@ drawable/ic_launcher" // small icon displayed during Program Execution
Android: label = "@ string/app_name" // program name displayed in the Information column above the mobile phone screen during Program Execution
Android: theme = "@ style/AppTheme" // theme style
>

<Activity // activity is the basic execution unit of the Android program.
Android: name = ". MainActivity" // The running is to enter this specified program
Android: label = "@ string/app_name">
<Intent-filter>
<Action android: name = "android. intent. action. MAIN"/> // determines the first program to be executed by the application.


<Category android: name = "android. intent. category. LAUNCHER"/> // determines whether the application is displayed in the program list.
</Intent-filter>
</Activity>
</Application>


</Manifest>


What are the links between xml in java and layout in android src and AndroidManifestxml? What role does it play?

In short, it is ing.
You can see that there is a gen folder under a normal android project, with a package name. r. java, similar to map's key-value, R. java stores key values, such as R. drawable. a corresponds to the res/drawable/a.png file, so we can use this key to obtain the path of this image file and load it as an image by loading the image, of course, some people may wonder why res/drawable-hdpi/a.png is not loaded. This is the attribute (such as resolution and density information) that the framework layer or the underlying layer reads from the machine) determine which folder to load.
Because it belongs to the same package and has a standard folder naming method, if you change the values folder to valuess, an error will be reported, which indicates that the path is written to death, therefore, we can use the id to get the file loading under the dead path.
The principle of loading resources in res in AndroidManifest. xml is similar to how. java in src Loads files in res.
But AndroidManifest. how to load. java, see the image. This is an apk file, classes. dex is all. A class file set after the java file is compiled, including the R. resources. in arsc, the matching information is placed, which is equivalent to the map information and the value corresponding to the key (id.
When the program starts, it first reads AndroidManifest. xml file. If you know the package name, the path of this program is invisible, AndroidManifest. xml contains some R. drawable. icon id, which reads the classes first. the R class file in dex, and then according to the matching table resources. if arsc knows where the target file is, it can be loaded. Of course, a control in classes. dex also wants to load resources in the same way.




What is the function of AndroidManifestxml when it is called?

Label is the name of the program. Its value = value of the app_name variable in String. xml. For example, there is

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.