AndroidManifest. xml and manifest nodes, androidmanifest. xml

Source: Internet
Author: User

AndroidManifest. xml and manifest nodes, androidmanifest. xml

References:
Http://developer.android.com/guide/topics/manifest/manifest-intro.html
Http://developer.android.com/guide/topics/manifest/manifest-element.html

Each Android Application Project root directory must have an AndroidManifest. xml file. This file contains the configuration information of the application in the Android system. This information will be read by the system and installed properly when the program is installed.
The information includes:
Basic Application information, including package name and version number
Component declaration and configuration information used in the Application
Sdk versions, functions, permissions, and libraries required by the application
Application publishing permission

Example:

<?xml version="1.0" encoding="utf-8"?><manifest>   <uses-permission/>    <permission/>    <permission-tree/>    <permission-group/>    <instrumentation/>    <uses-sdk/>    <uses-configuration/>    <uses-feature/>    <supports-screens/>    <compatible-screens/>    <supports-gl-texture/>    <application>     <activity>       <intent-filter>         <action/>          <category/>          <data/>       </intent-filter>        <meta-data/>     </activity>      <activity-alias>       <intent-filter>. . .</intent-filter>        <meta-data/>     </activity-alias>      <service>       <intent-filter>. . .</intent-filter>        <meta-data/>     </service>      <receiver>       <intent-filter>. . .</intent-filter>        <meta-data/>     </receiver>      <provider>       <grant-uri-permission/>        <meta-data/>        <path-permission/>     </provider>      <uses-library/>   </application> </manifest>

 

The manifest tag is the root node of the AndroidManifest. xml file. Syntax:

<manifest    xmlns:android="http://schemas.android.com/apk/res/android"    package="string"    android:sharedUserId="string"    android:sharedUserLabel="string resource"    android:versionCode="integer"    android:versionName="string"    android:installLocation=["auto" | "internalOnly" | "preferExternal"] >    . . .</manifest>

 

Attribute:

Xmlns: android
Namespace, fixed as http://schemas.android.com/apk/res/android

 

Package
Application Package name. The unique identifier of an application in the system, usually in the form of com. google. example. The package name and the automatically generated resource package name have a relationship, but it has nothing to do with the package name such as the Activity you created.

 

Android: sharedUserId
The Linux User ID shared with other applications, so that A can access files of B and B can also access files of. They can also run in a process. Note: multiple applications must use the same signature.

 

Android: sharedUserLabel
The text identifier of the sharedUserId. Valid only when android: sharedUserId is valid. It must be a string resource.

 

Android: versionCode
Application version number

 

Android: versionName
Application version name.

 

Android: installLocation
Default application installation location

Possible values:
Auto: internal storage is installed by default. If the internal storage is full, external storage is installed.
InternalOnly: it can only be installed in internal storage. If the internal storage is full, it cannot be installed (default value)
PreferExternal: preinstalled to external storage. If external storage is unavailable, it is installed to internal storage.
Note: external storage is unstable. Computer insertion may cause unavailability.


In the android project, two activity nodes are set in AndroidManifestxml, and an xml layout file is created in the layout directory.

Public class MainActivity extends Activity {

@ Override

Public void onCreate (Bundle savedInstanceState ){
Super. onCreate (savedInstanceState );
SetContentView (R. layout. activity_main );
}

SetContentView (R. layout. activity_main); this sentence sets the layout file corresponding to the activity

You need to add setContentView () to the onCreate () method of the Activity corresponding to a layout file.

Why does AndroidManifestxml always exist when you create an Android project? </manifest>

This is also true for me. One more </manifest> is generated each time. As a result, the R. java file cannot be generated. Let me know if the landlord solves the problem.
 

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.