Skip to content

WorkManager: java.lang.NoClassDefFoundError: java.time.Duration on api 23 #1630

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JosepBergay opened this issue Aug 3, 2020 · 2 comments
Closed

Comments

@JosepBergay
Copy link

Environment

  • CLI: 6.8.0
  • Cross-platform modules: 6.5.12
  • Android Runtime: 6.5.3
  • iOS Runtime (if applicable):
  • Plugin(s): Fresh angular helloworld project created with the CLI.

Describe the bug
Runtime error when instantiating 'androidx.work.PeriodicWorkRequest.Builder' on api 23:

new androidx.work.PeriodicWorkRequest.Builder(
        com.tns.workers.MyWorker.class,
        15,
        java.util.concurrent.TimeUnit.HOURS
    ).build()

Error: java.lang.NoClassDefFoundError: java.time.Duration

To Reproduce
Clone sample project and tns run android on an api 23 device.

Expected behavior
No error. On api >=27 seems to work as expected.

Sample project
https://github.com/JosepBergay/ns_workermanager_test/

Additional context
Also mentioned here: #1488 (comment)

@vmutafov
Copy link
Contributor

vmutafov commented Aug 3, 2020

As stated here: https://developer.android.com/reference/java/time/Duration this API is added in Android API 26

@JosepBergay JosepBergay changed the title java.lang.NoClassDefFoundError: java.time.Duration on api 23 WorkManager: java.lang.NoClassDefFoundError: java.time.Duration on api 23 Aug 3, 2020
@JosepBergay
Copy link
Author

As stated here: https://developer.android.com/reference/java/time/Duration this API is added in Android API 26

Thanks, didn't know that.
But I'm not (at least directly) using Duration API and neither does the constructor. OneTimeWorkRequest seems to work as expected, even when applying an initial delay with a method that has an overload involving Duration too.

If WorkManager is supposed to work on >14, how can I then build a PeriodicWorkRequest from NativeScript?

@JosepBergay JosepBergay closed this as not planned Won't fix, can't repro, duplicate, stale Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants