I am trying to learn WorkManager for Android using codeLab documentation. I app crash when I try to test functionality of beginUniqueWork(Ensure Unique Work)
I just implement beginUniqueWork and test app with selecting image multiple time.
Code I writre in aplyBlur() in ViewModel class is:
  void applyBlur(int blurLevel) {
    WorkContinuation continuation = mWorkManager
            .beginUniqueWork(IMAGE_MANIPULATION_WORK_NAME,
                    ExistingWorkPolicy.REPLACE,
                    OneTimeWorkRequest.from(CleanupWorker.class));
    // Add WorkRequests to blur the image the number of times requested
    for (int i = 0; i < blurLevel; i++) {
        OneTimeWorkRequest.Builder blurBuilder =
                new OneTimeWorkRequest.Builder(BlurWorker.class);
        // Input the Uri if this is the first blur operation
        // After the first blur operation the input will be the output of previous
        // blur operations.
        if ( i == 0 ) {
            blurBuilder.setInputData(createInputDataForUri());
        }
        continuation = continuation.then(blurBuilder.build());
    }
    // Add WorkRequest to save the image to the filesystem
    OneTimeWorkRequest save =
            new OneTimeWorkRequest.Builder(SaveImageToFileWorker.class)
                    .build();
    continuation = continuation.then(save);
    continuation.enqueue();
}
 
                        
This is https://issuetracker.google.com/79550068. It has been fixed now and the fix is available in alpha02 of WorkManager, which is out now.