Comment on page
Every Android app, large or small, has a very important little file in the root folder called
AndroidManifest.xml. This file describes crucial information about the app, including the application's name, the activities it holds, the permissions it requests, and the hardware and software requirements needed to run the app in the first place. Android Studio will handle the boilerplate code of the manifest when you first create the app, but often you will need to modify the file to suit your own needs.
The root element requires an attribute for your app's package name, which the build tools will use to resolve any relative classes in the package and generate the resources file.
<?xml version="1.0" encoding="utf-8"?>
In the child
<application ...>tag, these attributes specify project-specific information including where you set the app icon for your project.
Under the application tag is where most of the configuring will be done. For each activity that you create in your app, you must declare a corresponding XML activity element as a child of
AndroidManifest.xml. Otherwise, that activity will never be seen by the system and can never be launched with an intent.
An example manifest looks something like:
<manifest package="com.example.exampleproject" ... >
<application ... >
We can add a child element of type
Activityelement. This is where an activity specifies what implicit intents the application can receive. In the manifest file for Google’s Gmail app, one of the activities would have the action
android.intent.action.SENDunder their intent filter, which allows the application to receive the implicit intent with action
<action android:name="android.intent.action.SEND" />
The example below is of an activity that is recognized by the system as the entry point to this application (labeled with
action.MAIN), and as something that shows up and can be launched from the app drawer - the area in your phone where all installed apps are stored (labeled with
<activity android:name=".MainActivity" ... >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
The manifest file is a small but mighty beast that controls activities, permissions, and implicit intents. If this file becomes messed up, then some issues will likely manifest their way into your application. Heh 🤭