Junior — Middle
What structure and main components does the AndroidManifest.xml file include?
sobes.tech AI
Answer from AI
The AndroidManifest.xml file is mandatory for every Android application and contains important information for the system about the app. The main components and structure of the file:
- Root element
<manifest>: contains attributespackage(the unique identifier of the app) andxmlns:android. <application>element: describes the app itself, its icons, themes, components, and permissions.- Application components:
<activity>— describes a screen (activity).<service>— background services.<receiver>— broadcast message receivers.<provider>— content providers.
- Permissions (
<uses-permission>): specify what system permissions the app needs. - Minimum and target SDK versions (
<uses-sdk>): define the minimum and recommended Android versions.
Example of a minimal AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.app">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>