Search code examples
androidandroid-studioandroid-workmanagerapp-inspection

CoroutineWorker not showing up correctly in Android Studio's "Background Task Inspector"


I am calling several CoroutineWorker classes in my Android application. In the past, I could easily watch details for each worker execution in the "Background Task Inspector" of Android Studio. According to the documentation, the only requirement is version 2.5.0 or above.

Coming back to the project after a while, the app inspection pane has changed and grouping has been introduced:

New grouping of background tasks

This is not a problem. The problem is, that all of my "CoroutineWorker"s are showing up as Jobs and all are called "SystemJobService" all of a sudden:

Workers are showing up as Jobs and are called "SystemJobService"

Instead of "SystemJobService", I expect the name of the CoroutineWorker class to be displayed. Including additional information and features like Graph View. The options are still there, but my workers are not interpreted as such, hence, I can't make use of any of the features.

All the information displayed for my workers, which are showing up as jobs:

All the information displayed for my workers, which are showing up as jobs

I have tested this with Android SDK 32, AGP 7.4.2, am using Android Studio Flamingo 2022.2.1 Patch 2, and (among others) have installed the following libraries:

implementation "androidx.work:work-runtime:2.7.1"
implementation "androidx.work:work-runtime-ktx:2.7.1"
implementation "androidx.work:work-multiprocess:2.7.1"

After patching the IDE, I have run the project as usual and with the new pane, my workers were interpreted as jobs, including their anonymous class names.

  • I have tried older and newer (canary build) versions of Android Studio
  • I have tried updating to the latest WorkManager version 2.8.1
  • I have tried upgrading to AGP 8.0.2
  • I have tried running the project on an Android Emulator with SDK 28, 29, 30, 32, 33

But none of it made a difference. Some of the attempts in combination. I feel like the underlying issue is much simpler.


Solution

  • Solved. A very long time ago, I had a dependency pulled in, which required me to add the following inside the android block of my app's build.gradle. Without it, I was unable to generate a signed bundle for release.

    packagingOptions.resources.excludes += [
        "**/*.proto",
        "**/*.bin",
        "**/*.java",
        "**/*.properties",
        "**/*.version",
        "**/*.*_module",
        "META-INF/AL2.0",
        "META-INF/LGPL2.1",
    ]
    

    The dependency since has been updated (/fixed) and I don't require any of the excludes anymore to generate a signed bundle. Looks like one of the excludes messed with the information required for Android Studio to correctly interpret "workers".