マニフェスト ファイルとは、アプリケーションにどのようなコンポーネントが含まれていて、それがどのような振る舞いをするのかを明示するものです。
これはAndroidManifest.xmlというファイル名で、必ずプロジェクトのルートに置きます。たとえば、それは次のようなXML文書です。
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.helloandroid" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="2" /> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".HelloAndroid" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
AndroidManifest.xmlでマニフェストの定義に使用できる要素を、以下に示します。
| 分類 | 要素 | 説明 |
|---|---|---|
| <manifest> | マニフェスト ファイルのルート要素 | |
| permission | <uses-permission> | セキュリティ制限の解除を要求する |
| <permission> | ||
| <permission-tree> | ||
| <permission-group> | ||
| <instrumentation> | ||
| <uses-sdk> | アプリケーションが対応するAndroidのバージョン [必須] | |
| <uses-configuration> | ||
| <uses-feature> | ||
| <supports-screens> | ||
| <application> | アプリケーションの宣言 [必須] | |
| activity | <activity> | |
| <activity-alias> | ||
| <meta-data> | ||
| intent | <intent-filter> | インテントの型を明示する |
| <action> | インテント フィルタにアクション (action) を追加する | |
| <category> | インテント フィルタにカテゴリ名を追加する | |
| <data> | ||
| <service> | ||
| <receiver> | ||
| <provider> | ||
| <grant-uri-permission> | ||
| <uses-library> |