You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During tests app crashes when trying to initialize WorkManager / WorkManager initializer is not invoked from androidx.startup.InitializationProvider
#1026
Open
Roman-Markov opened this issue
Jul 24, 2024
· 2 comments
the app started to crash during appium tests with espresso driver.
Exception: 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.
Merged manifest file of the app under test has it declared to be initialized via androidx.startup.InitializationProvider
My custom provider was initialized and worked fine. Also I copied code from androidx.startup.InitializationProvider to my second custom provider. It could initialize WorkManger on app launch before WorkManager.getInstance(context); was invoked.
Appium: 2.10.3
Espresso driver: 3.3.0
When I added dependency to app under test
implementation 'androidx.work:work-runtime:2.9.0'
and later in code invoked
WorkManager.getInstance(context);
the app started to crash during appium tests with espresso driver.
Exception:
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.
Merged manifest file of the app under test has it declared to be initialized via androidx.startup.InitializationProvider
My custom provider was initialized and worked fine. Also I copied code from androidx.startup.InitializationProvider to my second custom provider. It could initialize WorkManger on app launch before
WorkManager.getInstance(context);
was invoked.Here is repos to reproduce the crash:
A bit modified android espresso sample app: https://github.com/Roman-Markov/appium-espresso-reproducible-crash
Simple appium test code: https://github.com/Roman-Markov/simple-appium-test-to-reproduce-crash
The text was updated successfully, but these errors were encountered: