Android AndroidManifest.xml Example

The AndroidManifest.xml file is the application's contract with the Android operating system — it declares what the app is, what components it contains, what permissions it requires, and what system events it can handle. Every Android app must have a valid manifest file. Errors in the manifest, whether structural XML problems or missing required attributes, prevent the app from building or cause cryptic runtime failures that are difficult to trace back to the manifest. This example shows a manifest with the two most common configuration scenarios: basic internet access permissions for any networked app, and a deep link intent filter that allows the app to open when users navigate to a custom URL scheme. The uses-permission elements declare OS-level permissions. android.permission.INTERNET is required for any network request — without it, all network calls are silently blocked. android.permission.ACCESS_NETWORK_STATE allows checking whether a network connection is available before attempting a request. These are "normal" permissions that are automatically granted at install time without a user prompt, unlike "dangerous" permissions (camera, location, contacts) that trigger runtime permission dialogs. The application element is where all app-level configuration lives. android:allowBackup="true" enables Android's backup system to include your app's data. android:icon and android:label reference resources (@mipmap/ic_launcher, @string/app_name) that provide the home screen icon and the app's display name. The first intent-filter on MainActivity is the launcher intent filter — it's what makes the activity appear on the home screen and in the app drawer. Both the MAIN action and LAUNCHER category are required. android:exported="true" is required on Android 12+ for any activity with an intent filter. The second intent-filter implements deep linking: ACTION_VIEW, DEFAULT category, and BROWSABLE category together make the activity openable from browser links and other apps. The data element with android:scheme="myapp" and android:host="open" means the activity handles URLs like myapp://open/... When a user taps such a link anywhere on their device, Android presents your app as an option (or opens it directly if it's the only handler). Permission strategy: Google Play Store reviews apps that request sensitive permissions and may reject or flag apps that use permissions not justified by their core functionality. Camera, location, contacts, and microphone permissions require explicit justification in the Play Console. Request only the minimum permissions needed, request them at the point of use (not at launch), and gracefully degrade functionality when users deny permissions. Real-world scenarios: an e-commerce app that handles myapp://product/12345 deep links from email campaigns; a messaging app that handles custom URL schemes for direct message threads; a loyalty app that handles deep links from QR codes printed on physical receipts. Tips: use the App Links Assistant in Android Studio to generate, test, and verify deep link configurations. Use adb shell am start -W -a android.intent.action.VIEW -d "myapp://open" to test deep links from the command line during development.

Example
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myapp">

  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

  <application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:theme="@style/AppTheme">

    <activity android:name=".MainActivity" android:exported="true">
      <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER"/>
      </intent-filter>
      <intent-filter>
        <action android:name="android.intent.action.VIEW"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <category android:name="android.intent.category.BROWSABLE"/>
        <data android:scheme="myapp" android:host="open"/>
      </intent-filter>
    </activity>

  </application>
</manifest>
[ open in XML Formatter → ]

FAQ

Why do I need android:exported="true" on activities?
Android 12 and higher require you to explicitly declare android:exported for any activity, service, or receiver that uses intent filters. Activities with a LAUNCHER intent filter must set exported="true".
What are deep links in Android?
Deep links allow a URL to open a specific screen in your app. Intent filters with ACTION_VIEW and a data element defining the scheme and host register your activity to handle those URLs from browsers and other apps.
How many permissions should I request?
Request only the minimum permissions required for your app's core functionality. Each permission adds friction in the install flow and may trigger additional Google Play policy review, especially for sensitive permissions.

Related Examples