How to use AndroidManifest

The AndroidManifest.xml file is a crucial component of any Android application. It acts as the manifest file for the application, providing essential information to the Android system about the app, its components, and permissions required for its functionality. This file is located in the root directory of the Android project and is automatically generated during the build process.

Key Components of AndroidManifest.xml

  • Application Tag: Contains all the application components like activities, services, receivers, etc.
  • Activity Declaration: Defines each activity in the application and its properties.
  • Permissions: Specifies the permissions the application needs to operate.
  • Intents: Sets rules for what intents can be handled by the application.

Example of AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.myapp"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> <uses-permission android:name="android.permission.INTERNET"/> </manifest>

AndroidManifest Android app components Android permissions Android activity declaration manifest file Android development