Search code examples
androidxandroid-workmanager

androidx.work.impl.WorkManagerInitializer: java.lang.ClassNotFoundException: "androidx.work.impl.WorkManagerInitializer" on path: /data/app/app-2.apk


I recently migrated my old app's background services to WorkManager. On recent devices (down to sdk 22 included) it looks OK, running repeating work units and scheduling them even across device reboots as expected.

The problem is when I test against old version (old is very relative here), Android sdk 14 which is my minSdkVersion. BTW also WorkManager should have the same: Backwards compatible up to API 14 according to doc. As stated in title, error I get is:

 java.lang.RuntimeException: Unable to get provider androidx.work.impl.WorkManagerInitializer: java.lang.ClassNotFoundException: Didn't find class "androidx.work.impl.WorkManagerInitializer" on path: /data/app/com.example.myapp.apk
    at android.app.ActivityThread.installProvider(ActivityThread.java:4822)

I don't have any custom WorkManager configuration/initialization, I simply added

     implementation 'androidx.work:work-runtime:2.2.0'

to my module's gradle and used it quite typcally to schedule background operations.


Solution

  • Problem was caused by multiDexEnabled true which I had in defaultConfig for unknown reasons. I found it out after some digging and an issue