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