1page.title=<manifest> 2parent.title=The AndroidManifest.xml File 3parent.link=manifest-intro.html 4@jd:body 5 6<dl class="xml"> 7<dt>syntax:</dt> 8<dd><pre class="stx"><manifest xmlns:<a href="#nspace">android</a>="http://schemas.android.com/apk/res/android" 9 <a href="#package">package</a>="<i>string</i>" 10 android:<a href="#uid">sharedUserId</a>="<i>string</i>" 11 android:<a href="#uidlabel">sharedUserLabel</a>="<i>string resource</i>" <!-- ##api level 3## --> 12 android:<a href="#vcode">versionCode</a>="<i>integer</i>" 13 android:<a href="#vname">versionName</a>="<i>string</i>" 14 android:<a href="#install">installLocation</a>=["auto" | "internalOnly" | "preferExternal"] > 15 . . . 16</manifest></pre></dd> 17 18<p> 19<dt>contained in:</dt> 20<dd><i>none</i></dd> 21 22<p> 23<p> 24<dt>must contain:</dt> 25<dd><code><a href="{@docRoot}guide/topics/manifest/application-element.html"><application></a></code></dd> 26 27<dt>can contain:</dt> 28<dd><code><a href="{@docRoot}guide/topics/manifest/instrumentation-element.html"><instrumentation></a></code> 29<br/><code><a href="{@docRoot}guide/topics/manifest/permission-element.html"><permission></a></code> 30<br/><code><a href="{@docRoot}guide/topics/manifest/permission-group-element.html"><permission-group></a></code> 31<br/><code><a href="{@docRoot}guide/topics/manifest/permission-tree-element.html"><permission-tree></a></code> 32<br/><code><a href="{@docRoot}guide/topics/manifest/uses-configuration-element.html"><uses-configuration></a></code> <!-- ##api level 3## --> 33<br/><code><a href="{@docRoot}guide/topics/manifest/uses-permission-element.html"><uses-permission></a></code></dd> 34<br/><code><a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html"><uses-sdk></a></code></dd> 35 36<p> 37<dt>description:</dt> 38<dd>The root element of the AndroidManifest.xml file. It must 39contain an <code><a href="{@docRoot}guide/topics/manifest/application-element.html"><application></a></code> element 40and specify {@code xmlns:android} and {@code package} attributes.</dd> 41 42<dt>attributes:</dt> 43<dd> 44<dl class="attr"> 45<dt><a name="nspace"></a>{@code xmlns:android}</dt> 46<dd>Defines the Android namespace. This attribute should always be set 47to "{@code http://schemas.android.com/apk/res/android}".</dd> 48 49<dt><a name="package"></a>{@code package}</dt> 50<dd>A full Java-language-style package name for the application. The name should 51be unique. The name may contain uppercase or lowercase letters ('A' 52through 'Z'), numbers, and underscores ('_'). However, individual 53package name parts may only start with letters. 54 55<p>To avoid conflicts with other developers, you should use Internet domain ownership as the 56basis for your package names (in reverse). For example, applications published by Google start with 57<code>com.google</code>. You should also never use the <code>com.example</code> namespace when 58publishing your applications.</p> 59 60 <p> 61 The package name serves as a unique identifier for the application. 62 It's also the default name for the application process (see the 63 <code><a href="{@docRoot}guide/topics/manifest/application-element.html"><application></a></code> 64 element's 65 <code><a href="{@docRoot}guide/topics/manifest/application-element.html#aff">process</a></code> 66 process</a></code> attribute) and the default task affinity of an activity 67 (see the 68 <code><a href="{@docRoot}guide/topics/manifest/activity-element.html"><activity></a></code> 69 element's 70 <code><a href="{@docRoot}guide/topics/manifest/activity-element.html#aff">taskAffinity</a></code> attribute). 71 </p> 72 73 <p class="caution"><strong>Caution:</strong> Once you publish your application, you 74<strong>cannot change the package name</strong>. The package name defines your application's 75identity, so if you change it, then it is considered to be a different application and users of 76the previous version cannot update to the new version.</p> 77 78</dd> 79 80<dt><a name="uid"></a>{@code android:sharedUserId}</dt> 81<dd>The name of a Linux user ID that will be shared with other applications. 82By default, Android assigns each application its own unique user ID. 83However, if this attribute is set to the same value for two or more applications, 84they will all share the same ID — provided that they are also signed 85by the same certificate. Application with the same user ID can access each 86other's data and, if desired, run in the same process.</dd> 87 88<dt><a name="uidlabel"></a>{@code android:sharedUserLabel}</dt> 89<dd>A user-readable label for the shared user ID. The label must be set as 90a reference to a string resource; it cannot be a raw string. 91 92 <p> 93 <!-- ##api level indication## --> 94 This attribute was introduced in API Level 3. It is meaningful only if the 95 <code><a href="#uid">sharedUserId</a></code> attribute is also set. 96 </p> 97</dd> 98 99<dt><a name="vcode"></a>{@code android:versionCode}</dt> 100<dd>An internal version number. This number is used only to determine whether 101one version is more recent than another, with higher numbers indicating more 102recent versions. This is not the version number shown to users; that number 103is set by the {@code versionName} attribute. 104 105 <p> 106 The value must be set as an integer, such as "100". You can define it however 107 you want, as long as each successive version has a higher number. For example, 108 it could be a build number. Or you could translate a version number in "x.y" 109 format to an integer by encoding the "x" and "y" separately in the lower and 110 upper 16 bits. Or you could simply increase the number by one each time a new 111 version is released. 112 </p> 113</dd> 114 115<dt><a name="vname"></a>{@code android:versionName}</dt> 116<dd>The version number shown to users. This attribute can be set as a raw 117string or as a reference to a string resource. The string has no other purpose 118than to be displayed to users. The {@code versionCode} attribute holds 119the significant version number used internally. 120</dd> 121 122<dt><a name="install"></a>{@code android:installLocation}</dt> 123<dd>The default install location for the application. 124 125<p>The following keyword strings are accepted:</p> 126 127<table> 128<tr> 129 <th>Value</th> 130 <th>Description</th> 131</tr><tr> 132 <td>"{@code internalOnly}"</td> 133 <td>The application must be installed on the internal device storage only. If this is set, 134the application will never be installed on the external storage. If the internal 135storage is full, then the system will not install the application. This is also the default behavior 136if you do not define {@code android:installLocation}.</td> 137</tr><tr> 138 <td>"{@code auto}"</td> 139 <td>The application may be installed on the external storage, but the system will install the 140application on the internal storage by default. If the internal storage is full, then the system 141will install it on the external storage. Once installed, the user can move the application 142to either internal or external storage through the system settings.</td> 143</tr><tr> 144 <td>"{@code preferExternal}"</td> 145 <td>The application prefers to be installed on the external storage (SD card). There is no 146guarantee that the system will honor this request. The application might be installed on internal 147storage if the external media is unavailable or full. Once installed, the user can move the application to 148either internal or external storage through the system settings.</td> 149</tr> 150</table> 151 152<p class="note"><strong>Note:</strong> By default, your application will be installed on the 153 internal storage and cannot be installed on the external storage unless you define this attribute 154 to be either "{@code auto}" or "{@code preferExternal}".</p> 155 156<p>When an application is installed on the external storage:</p> 157<ul> 158 <li>The {@code .apk} file is saved 159to the external storage, but any application data (such as databases) is still saved on 160the internal device memory.</li> 161 <li>The container in which the {@code .apk} file is saved is encrypted with a key that allows 162the application to operate only on the device that installed it. (A user cannot 163transfer the SD card to another device and use applications installed on the card.) Though, 164multiple SD cards can be used with the same device.</li> 165 <li>At the user's request, the application can be moved to the internal storage.</li> 166</ul> 167 168<p>The user may also request to move an application from the internal storage to the external 169storage. However, the system will not allow the user to move the application to external storage if 170this attribute is set to {@code internalOnly}, which is the default setting.</p> 171 172<p>Read <a href="{@docRoot}guide/topics/data/install-location.html">App Install Location</a> for 173more information about using this attribute (including how to maintain backward compatibility).</p> 174 175<p>Introduced in: API Level 8.</p> 176 177 178</dd> 179 180</dl> 181</dd><!-- end attributes --> 182 183<!-- ##api level indication## --> 184<dt>introduced in:</dt> 185<dd>API Level 1 for all attributes, unless noted otherwise in the attribute description.</dd> 186 187<p> 188<dt>see also:</dt> 189<dd> 190<code><a href="{@docRoot}guide/topics/manifest/application-element.html"><application></a></code></dd> 191 192</dl> 193