It is solved by adding
implementation 'androidx.work:work-runtime:2.7.0-alpha05'
in my gradle. (You can add the latest release version of this library)
Seems like it is a bug in workmanager. Check the bug fix in Version 2.7.0-alpha02
https://developer.android.com/jetpack/androidx/releases/work#2.7.0-alpha02