Search this site
Embedded Files
Android Tutorial
  • Home
  • App Components
    • Activities
    • Intents
    • Services
    • Content Providers
    • Broadcast Receivers
  • App Manifest
    • Manifest File Structure
    • Compatible Screen
    • Instrumentation
    • Permission
    • Permission Group
    • Permission Tree
    • Supports GL Texture
    • Supports Screens
    • Uses Configuration
    • Uses Features
    • Uses Permission
    • Uses SDK
  • App Resources
    • Resource Types
    • Drawable
    • Layouts
    • Mipmap
    • Values
    • XML
    • App NameSpaces
  • App UI
    • Styles and Themes
    • Inputs Controls (Button, TextView ...)
    • Inputs Events (onClick, onKey ...)
    • Menu
    • Custom Components
    • Asset Studio
  • App Classes
    • Main Classes
    • Widgets Classes
  • Material Design
    • Buttons
    • Motion
  • App How To ...
Android Tutorial
  • Home
  • App Components
    • Activities
    • Intents
    • Services
    • Content Providers
    • Broadcast Receivers
  • App Manifest
    • Manifest File Structure
    • Compatible Screen
    • Instrumentation
    • Permission
    • Permission Group
    • Permission Tree
    • Supports GL Texture
    • Supports Screens
    • Uses Configuration
    • Uses Features
    • Uses Permission
    • Uses SDK
  • App Resources
    • Resource Types
    • Drawable
    • Layouts
    • Mipmap
    • Values
    • XML
    • App NameSpaces
  • App UI
    • Styles and Themes
    • Inputs Controls (Button, TextView ...)
    • Inputs Events (onClick, onKey ...)
    • Menu
    • Custom Components
    • Asset Studio
  • App Classes
    • Main Classes
    • Widgets Classes
  • Material Design
    • Buttons
    • Motion
  • App How To ...
  • More
    • Home
    • App Components
      • Activities
      • Intents
      • Services
      • Content Providers
      • Broadcast Receivers
    • App Manifest
      • Manifest File Structure
      • Compatible Screen
      • Instrumentation
      • Permission
      • Permission Group
      • Permission Tree
      • Supports GL Texture
      • Supports Screens
      • Uses Configuration
      • Uses Features
      • Uses Permission
      • Uses SDK
    • App Resources
      • Resource Types
      • Drawable
      • Layouts
      • Mipmap
      • Values
      • XML
      • App NameSpaces
    • App UI
      • Styles and Themes
      • Inputs Controls (Button, TextView ...)
      • Inputs Events (onClick, onKey ...)
      • Menu
      • Custom Components
      • Asset Studio
    • App Classes
      • Main Classes
      • Widgets Classes
    • Material Design
      • Buttons
      • Motion
    • App How To ...

Manifest File Structure

Structure of the android Manifest File

The first row of the Android Manifest file <AndroidManifest.xml> (located in the app/manifests directory) represents the xml file declaration. The explanation of this first row can be hound here.

<?xml version="1.0" encoding="utf-8"?>

From second row onward there is the specific content (here)

<manifest>
          package="string"
          android:sharedUserId="string"
          android:sharedUserLabel="string resource" 
          android:versionCode="integer"
          android:versionName="string"
          android:installLocation=["auto" | "internalOnly" | "preferExternal"] >
    <compatible-screens />  
    <instrumentation />
    <permission />
    <permission-group />
    <permission-tree />
    <supports-gl-texture />  
    <supports-screens />
    <uses-configuration />  
    <uses-feature />  
    <uses-permission />
    <uses-permission-sdk-23 />
    <uses-sdk />

    <application>
             android:allowTaskReparenting=["true" | "false"]
             android:allowBackup=["true" | "false"]
             android:backupAgent="string"
             android:backupInForeground=["true" | "false"]
             android:banner="drawable resource"
             android:debuggable=["true" | "false"]
             android:description="string resource"
             android:directBootAware=["true" | "false"]
             android:enabled=["true" | "false"]
             android:extractNativeLibs=["true" | "false"]
             android:fullBackupContent="string"
             android:fullBackupOnly=["true" | "false"]
             android:hasCode=["true" | "false"]
             android:hardwareAccelerated=["true" | "false"]
             android:icon="drawable resource"
             android:isGame=["true" | "false"]
             android:killAfterRestore=["true" | "false"]
             android:largeHeap=["true" | "false"]
             android:label="string resource"
             android:logo="drawable resource"
             android:manageSpaceActivity="string"
             android:name="string"
             android:networkSecurityConfig="xml resource"
             android:permission="string"
             android:persistent=["true" | "false"]
             android:process="string"
             android:restoreAnyVersion=["true" | "false"]
             android:requiredAccountType="string"
             android:resizeableActivity=["true" | "false"]
             android:restrictedAccountType="string"
             android:supportsRtl=["true" | "false"]
             android:taskAffinity="string"
             android:testOnly=["true" | "false"]
             android:theme="resource or theme"
             android:uiOptions=["none" | "splitActionBarWhenNarrow"]
             android:usesCleartextTraffic=["true" | "false"]
             android:vmSafeMode=["true" | "false"] >

        <activity 
             android:allowEmbedded=["true" | "false"]
             android:allowTaskReparenting=["true" | "false"]
             android:alwaysRetainTaskState=["true" | "false"]
             android:autoRemoveFromRecents=["true" | "false"]
             android:banner="drawable resource"
             android:clearTaskOnLaunch=["true" | "false"]
             android:configChanges=["mcc", "mnc", "locale",
                                 "touchscreen", "keyboard", "keyboardHidden",
                                 "navigation", "screenLayout", "fontScale",
                                 "uiMode", "orientation", "screenSize",
                                 "smallestScreenSize"]
             android:directBootAware=["true" | "false"]
             android:documentLaunchMode=["intoExisting" | "always" |
                                  "none" | "never"]
             android:enabled=["true" | "false"]
             android:excludeFromRecents=["true" | "false"]
             android:exported=["true" | "false"]
             android:finishOnTaskLaunch=["true" | "false"]
             android:hardwareAccelerated=["true" | "false"]
             android:icon="drawable resource"
             android:label="string resource"
             android:launchMode=["standard" | "singleTop" |
                              "singleTask" | "singleInstance"]
             android:maxRecents="integer"
             android:multiprocess=["true" | "false"]
             android:name="string"
             android:noHistory=["true" | "false"]  
             android:parentActivityName="string" 
             android:persistableMode=["persistRootOnly" | 
                                   "persistAcrossReboots" | "persistNever"]
             android:permission="string"
             android:process="string"
             android:relinquishTaskIdentity=["true" | "false"]
             android:resizeableActivity=["true" | "false"]
             android:screenOrientation=["unspecified" | "behind" |
                                     "landscape" | "portrait" |
                                     "reverseLandscape" | "reversePortrait" |
                                     "sensorLandscape" | "sensorPortrait" |
                                     "userLandscape" | "userPortrait" |
                                     "sensor" | "fullSensor" | "nosensor" |
                                     "user" | "fullUser" | "locked"]
             android:showForAllUsers=["true" | "false"]
             android:stateNotNeeded=["true" | "false"]
             android:supportsPictureInPicture=["true" | "false"]
             android:taskAffinity="string"
             android:theme="resource or theme"
             android:uiOptions=["none" | "splitActionBarWhenNarrow"]
             android:windowSoftInputMode=["stateUnspecified",
                                       "stateUnchanged", "stateHidden",
                                       "stateAlwaysHidden", "stateVisible",
                                       "stateAlwaysVisible", "adjustUnspecified",
                                       "adjustResize", "adjustPan"] >   
            <intent-filter>
               android:icon="drawable resource"
               android:label="string resource"
               android:priority="integer" >
                <action android:name="string" />
                <category android:name="string"/>
                <data 
                  android:scheme="string"
                  android:host="string"
                  android:port="string"
                  android:path="string"
                  android:pathPattern="string"
                  android:pathPrefix="string"
                  android:mimeType="string" />
            </intent-filter>
            <meta-data 
               android:name="string"
               android:resource="resource specification"
               android:value="string" />
        </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>

NOTES on <manifest> section

Why this line xmlns:android=“http://schemas.android.com/apk/res/android” must be the first in the layout xml file?

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.gcarabel.modifymanifest"
    android:sharedUserId="string"
    android:sharedUserLabel="string resource" 
    android:versionCode="1"
    android:versionName="1.16" 
    android:installLocation=["auto" | "internalOnly" | "preferExternal"] >
  • Xmlns means xml namespace.
  • It is created to avoid naming conflicts in the xml’s.
  • In order to avoid naming conflicts by any other way we need to provide each element with a prefix.
  • to avoid repetitive usage of the prefix in each xml tag we use xmlns at the root of the xml. Hence we have the tag xmlns:android=”http://schemas.android.com/apk/res/android”
  • Now android here simply means we are assigning the namespace “http://schemas.android.com/apk/res/android” to it.
  • This namespace is not a URL but a URI also known as URN (universal resource name) which is rarely used in place of URI.
  • Due to this android will be responsible to identify the android related elements in the xml document which would be android:xxxxxxx etc. Without this namespace android:xxxxxxx will be not recognized.

See here to get info about these fields

android:sharedUserId="string"
android:sharedUserLabel="string resource" 

Shared user ID application example

See here to get info about this field

android:installLocation=["auto" | "internalOnly" | "preferExternal"]
Google Sites
Report abuse
Google Sites
Report abuse