WorkManager 未正确初始化
WorkManager is not initialized properly
我在我的应用程序中使用工作管理器和最新的库
implementation 'androidx.work:work-runtime:2.7.1'
清单中
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
tools:node="remove">
</provider>
申请class
class App : Application(), Configuration.Provider {
override fun getWorkManagerConfiguration() =
Configuration.Builder()
.build()
override fun onCreate() {
super.onCreate()
WorkManager.initialize(this, Configuration.Builder().build())
}
}
我在应用程序中添加了初始化 class。然而我仍然面临这个错误
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.
不确定是什么问题
但是删除应用程序并重新安装工作正常
我在我的应用程序中使用工作管理器和最新的库
implementation 'androidx.work:work-runtime:2.7.1'
清单中
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
tools:node="remove">
</provider>
申请class
class App : Application(), Configuration.Provider {
override fun getWorkManagerConfiguration() =
Configuration.Builder()
.build()
override fun onCreate() {
super.onCreate()
WorkManager.initialize(this, Configuration.Builder().build())
}
}
我在应用程序中添加了初始化 class。然而我仍然面临这个错误
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.
不确定是什么问题 但是删除应用程序并重新安装工作正常