- 構文:
<instrumentation android:functionalTest=["true" | "false"] android:handleProfiling=["true" | "false"] android:icon="drawable resource" android:label="string resource" android:name="string" android:targetPackage="string" android:targetProcesses="string" />
- 上位の要素:
<manifest>
- 説明:
- アプリとシステムのインタラクションをモニタリングできるようにする
Instrumentation
クラスを宣言します。Instrumentation
オブジェクトは、アプリ コンポーネントよりも前にインスタンス化されます。 - 属性:
android:functionalTest
Instrumentation
クラスが機能テストとして実行されるかどうか。実行する場合はtrue
、そうでない場合はfalse
です。デフォルト値はfalse
です。android:handleProfiling
Instrumentation
オブジェクトがプロファイリングのオンとオフの切り替えを実行するかどうか。このオブジェクトがプロファイリングの開始と停止のタイミングを決定する場合はtrue
、実行中にプロファイリングが続行される場合はfalse
です。値をtrue
にした場合、このオブジェクトは、特定の処理セットにおいてプロファイリングをターゲットにすることができます。デフォルト値はfalse
です。android:icon
Instrumentation
クラスを表すアイコン。この属性は、ドローアブル リソースへの参照として設定する必要があります。android:label
- ユーザーが読むことができる、
Instrumentation
クラスのラベル。ラベルは、未加工の文字列または文字列リソースへの参照として設定できます。 android:name
Instrumentation
サブクラスの名前。完全修飾クラス名(com.example.project.StringInstrumentation
など)を使用します。ただし、短縮形として名前の最初の文字をピリオドにした場合、<manifest>
要素で指定したパッケージ名に付加されます。デフォルト値はありません。名前の指定は必須です。
android:targetPackage
Instrumentation
オブジェクトの実行対象となるアプリ。アプリは、マニフェスト ファイル内で<manifest>
要素によって割り当てられているパッケージ名で識別されます。android:targetProcesses
Instrumentation
オブジェクトの実行対象となるプロセス。カンマ区切りのリストで、インストルメンテーションの実行対象となる特定のプロセスを指定できます。値"*"
は、android:targetPackage
で定義されたアプリのすべてのプロセスに対してインストルメンテーションが実行されることを示します。この値をマニフェスト内で指定しなかった場合、インストルメンテーションは、
android:targetPackage
内で定義されているアプリのメインプロセスに対してのみ実行されます。この属性は API レベル 26 で追加されました。
- 導入時の API レベル:
- API レベル 1
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-07-27 UTC。
[null,null,["最終更新日 2025-07-27 UTC。"],[],[],null,["# <instrumentation\u003e\n\nsyntax:\n:\n\n ```xml\n \u003cinstrumentation android:functionalTest=[\"true\" | \"false\"]\n android:handleProfiling=[\"true\" | \"false\"]\n android:icon=\"drawable resource\"\n android:label=\"string resource\"\n android:name=\"string\"\n android:targetPackage=\"string\"\n android:targetProcesses=\"string\" /\u003e\n ```\n\ncontained in:\n: [\u003cmanifest\u003e](/guide/topics/manifest/manifest-element)\n\ndescription:\n: Declares an [Instrumentation](/reference/android/app/Instrumentation) class that lets you\n monitor an application's interaction with the system. The `Instrumentation`\n object is instantiated before any of the application's components.\n\nattributes:\n:\n\n `android:functionalTest`\n : Whether the `Instrumentation` class runs as a functional test.\n This is `true` if it does and `false` if not. The\n default value is `false`.\n\n `android:handleProfiling`\n : Whether the `Instrumentation` object turns profiling on and\n off. This is `true` if it determines when profiling starts and\n stops and `false` if profiling continues the entire time it is\n running. A value of `true` enables the object to target profiling\n at a specific set of operations. The default value is `false`.\n\n `android:icon`\n : An icon that represents the `Instrumentation` class. This attribute\n must be set as a reference to a drawable resource.\n\n `android:label`\n : A user-readable label for the `Instrumentation` class. The label\n can be set as a raw string or a reference to a string resource.\n\n `android:name`\n : The name of the `Instrumentation` subclass.\n Use a fully qualified class name, such as\n `com.example.project.StringInstrumentation`. However, as a shorthand,\n if the first character of the name is a period, it is appended to the package\n name specified in the [\u003cmanifest\u003e](/guide/topics/manifest/manifest-element) element.\n\n\n There is no default. The name must be specified.\n\n `android:targetPackage`\n : The application that the `Instrumentation` object runs\n against. An application is identified by the package name assigned in its\n manifest file by the `\u003cmanifest\u003e` element.\n\n `android:targetProcesses`\n\n : The processes that the `Instrumentation` object\n runs against. A comma-separated list indicates that the instrumentation runs\n against those specific processes. A value of `\"*\"` indicates that the\n instrumentation runs against all processes of the app defined in\n `android:targetPackage`.\n\n If this value isn't provided in the manifest, the instrumentation runs\n only against the main process of the app defined in\n `android:targetPackage`.\n\n This attribute was added in API level 26.\n\nintroduced in:\n: API level 1"]]