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.
I have the same problem in Androd 19
Reading this and this I solved using
Gradle:
multiDexEnabled true
Java:
public class MyApp extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
Problem was caused by multiDexEnabled true
which I had in defaultConfig for unknown reasons. I found it out after some digging and an issue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With