androidx.work.impl.WorkManagerInitializer:java.lang.ClassNotFoundException:"androidx.work.impl.WorkManagerInitializer"在路径上:/data/app/app-2.apk [英] androidx.work.impl.WorkManagerInitializer: java.lang.ClassNotFoundException: "androidx.work.impl.WorkManagerInitializer" on path: /data/app/app-2.apk
问题描述
我最近将旧应用的后台服务迁移到了 WorkManager .在最新的设备(包括到 sdk 22 )上,它看起来不错,可以运行重复的工作单元,甚至可以按预期在设备重新启动后安排它们.
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.
问题是当我针对旧版本(此处的旧版本非常相关)(即我的 minSdkVersion
)Android sdk 14进行测试时.BTW WorkManager
也应该具有相同的功能:向后兼容API 14 (根据
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)
我没有任何自定义WorkManager配置/初始化,我只是添加了
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.
推荐答案
问题是由 multiDexEnabled true
引起的,出于未知原因,我在defaultConfig中拥有它.经过一番挖掘和问题
Problem was caused by multiDexEnabled true
which I had in defaultConfig for unknown reasons. I found it out after some digging and an issue
这篇关于androidx.work.impl.WorkManagerInitializer:java.lang.ClassNotFoundException:"androidx.work.impl.WorkManagerInitializer"在路径上:/data/app/app-2.apk的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!