Fix for WorkManager not Initialized Crash #2052
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
One Line Summary
This is a fix for the non-reproducible WorkManager is not Initialized Crash we did in
v4
already, with one small change in a try-catch.Details
Motivation
Based on the the fix we made for
v4
at #1721The change I added was an additional try-catch after this comment from an SDK user after we made the
v4
fix. They ran into the "WorkManager is already initialized" exception.At the time that PR was made, the fixes were speculative and we didn't completely understand this crash. By now, and seeing other reports from SDK authors at our submitted Google Issue Tracker, I believe it is a bug in the library.
Scope
WorkManager.isInitialized()
public method introduced inandroidx.work:work-*:2.8.0-alpha02
.v4
of the SDKTesting
Unit testing
No unit testing
Manual testing
Limited ability to test manually due to unable to reproduce
Affected code checklist
Checklist
Overview
Testing
Final pass
This change is