[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Debug your WorkManager workers with Background Task Inspector\n\nThe Background Task Inspector helps\nyou visualize, monitor, and debug your app's background workers when using\n[WorkManager library](/jetpack/androidx/releases/work) 2.5.0 or higher.\n\nGet started\n-----------\n\nTo list workers in the Background Task Inspector, do the following:\n\n1. [Run your app](/studio/run) on an emulator or connected device running API\n level 26 or higher.\n\n2. Select **View \\\u003e Tool Windows \\\u003e App Inspection** from the menu bar.\n\n3. Select the **Background Task Inspector** tab.\n\n4. Select the running app process from the menu.\n\n5. The workers in the currently running app appear in the **Background Task\n Inspector** pane. Click on the worker that you want to inspect further.\n\nView and inspect workers\n------------------------\n\nWhen you deploy an app using WorkManager 2.5.0 or higher on a device running\nAPI level 26 or higher, the **Background Task Inspector** tab shows active\nworkers. The **Background Task Inspector** (shown in a\n[later section](/studio/inspect/task#inspect-jobs-alarms-wakelocks) as figure 3)\nlists the class name, current status, start time, and retries of all jobs,\nwhether they are running, failed, or completed.\n\n### Work Details\n\nClick a job from the list to open the **Work Details** panel,\nwhich displays detailed information about the worker, as shown in figure 1.\n**Figure 1.** **Work Details** panel.\n\n- **Description**: This section lists the worker class name, with the fully qualified package, as well as the assigned tag and the UUID of the worker.\n- **Execution**: This section shows the worker's constraints (if any), running frequency, and state, as well as which class created and queued the worker.\n- **WorkContinuation**: This section displays where the worker is in the work chain. To check the details of another worker in the work chain, click its UUID.\n- **Results**: This section displays the start time, retry count, and the output data of the selected worker.\n\n### Cancel workers\n\nTo stop a currently running or enqueued worker, select the worker and click\n**Cancel Selected Worker**\nfrom the toolbar.\n\n### View Graph View\n\nBecause workers can be chained together, it's sometimes useful to visualize\nworker dependencies as a graph.\n\nTo see a visual representation of a worker\nchain, select a worker from the table and click **Show Graph View** from the toolbar. Only workers are drawn in the graph.\n**Figure 2.** Graph View.\n\nThe graph lets you quickly see relationships between workers and monitor\ntheir progress in complex chaining relationships.\n\nTo return to the list view, click **Show List View** .\n\nView and inspect Jobs, Alarms, and Wakelocks\n--------------------------------------------\n\nThe Background Task Inspector also lets you inspect your app's Jobs, Alarms,\nand Wakelocks. Each type of asynchronous task appears under the appropriate\nheading in the inspector tab, letting you easily monitor its status and\nprogress.\n\nSimilar to workers, you can select a Job, Alarm, or Wakelock to\ninspect its detailed information in the Task Details panel.\n\nTo view detailed information for a Worker, Job, Alarm, or Wakelock,\nselect it in the **Task Details** panel on the right.\n**Figure 3.** The Background Task Inspector window. **Note:** This functionality has been migrated from the **Energy profiler** . Use the **Background Task Inspector** to inspect all of your app's asynchronous tasks.\n\nAdditional resources\n--------------------\n\nTo learn more about the Background Task Inspector, see the following additional\nresources:\n\n### Documentation\n\n- [Schedule tasks with WorkManager](/topic/libraries/architecture/workmanager)\n\n### Codelabs\n\n- [Background work with WorkManager](https://developer.android.com/codelabs/android-workmanager)\n- [Advanced WorkManager](https://developer.android.com/codelabs/android-adv-workmanager)\n\n### Blog posts\n\n- [Background Task Inspector](https://medium.com/androiddevelopers/background-task-inspector-30c8706f0380)"]]