我想知道是否可以使用WorkManager在方法上运行本地单元测试。我运行了本地单元测试,该测试通过WorkManager连接到方法,但出现以下错误。
java.lang.IllegalStateException: WorkManager is not initialized properly. You have explicitly disabled WorkManagerInitializer in your manifest, have not manually called WorkManager#initialize at this point, and your Application does not implement Configuration.Provider.
我可以使用具有WorkManager的方法来运行委托单元测试。
[使用WorkManager,您无法在主机上运行本地单元测试,需要编写在模拟器或Android设备上运行的集成测试。WorkaManager Guide上有可用的文档,一些代码实验室也介绍了这些文档: