Android 您可以使用WorkManager运行Unit on方法吗?
我想知道是否可以使用WorkManager在方法上运行本地单元测试。我运行了一个本地单元测试,该测试连接到一个带有WorkManager的方法,我得到了以下错误Android 您可以使用WorkManager运行Unit on方法吗?,android,android-testing,android-workmanager,Android,Android Testing,Android Workmanager,我想知道是否可以使用WorkManager在方法上运行本地单元测试。我运行了一个本地单元测试,该测试连接到一个带有WorkManager的方法,我得到了以下错误 java.lang.IllegalStateException: WorkManager is not initialized properly. You have explicitly disabled WorkManagerInitializer in your manifest, have not manually called
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设备上运行的集成测试。 上有可用的文档,这也包含在一些代码实验室中: