Fixed
Status Update
Comments
su...@google.com <su...@google.com> #2
Seems like it happens on API 21-22 too.
ch...@gmail.com <ch...@gmail.com> #3
This is expected. You are calling: enqueueUniquePeriodicWork() with an ExistingPeriodicWorkPolicy.REPLACE. This will cancel running work, and kick off new instances of all Workers.
https://github.com/rubensousa/WorkManagerKitkatBug/blob/master/app/src/main/java/com/github/rubensousa/workkitkatbug/MainActivity.kt#L24
[Deleted User] <[Deleted User]> #4
I just ran the sample again and now the behaviour is different for some weird reason. I forgot to mention that I only used REPLACE to test this properly. Because it also happens with KEEP.
ro...@gmail.com <ro...@gmail.com> #5
And shouldn't the behaviour be consistent across all Android versions?
su...@google.com <su...@google.com> #6
We don't see any issues with KEEP. If you have a way for us to reproduce any problems, please send us the appropriate instructions.
su...@google.com <su...@google.com> #7
Ok, I found something odd. Seems like setRequiredNetworkType(NetworkType.UNMETERED) causes this for some reason. I'm going to update the sample so you can review this again. Please, reopen this since it's not intended behavior.
ch...@instacart.com <ch...@instacart.com> #8
This happens on a fresh install with KEEP instead of REPLACE if the constraints have setRequiredNetworkType(NetworkType.UNMETERED). I've updated the sample
Description
Version used: 1.0.0-alpha12
After upgrading to alpha12, all of my Workers written in Kotlin (and CoroutineWorkers, FWIW), complain about the 'Result' return value with an error that says: "One type argument expected for class Result<out T>"
It appears that the Kotlin standard library contains a public inline Result class already:
The Kotlin Result class is automatically available in every file, so Android Studio (3.2.1) doesn't offer to import the androidx.work.Result class, causing the error since it assumes you want to use the already available kotlin Result.
There were two workarounds, neither very friendly:
1) Use the fully qualified androidx.work.Result
2) Manually adding the androidx.work.Result import statement
Note that:
- Using the fully qualified name, then using the Android Studio option to add import did not work
- Removing the doWork method entirely and using Android Studio's quick fix to implement the method did add an import to androidx.work.Result, so new classes would avoid running into this issue.