★ wanayoo — archive 1999 https://github.com/NativeScript/android-runtime/issues/1630Nouvelle recherche | Portail wanayoo
Skip to content
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

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

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

Comments

@JosepBergay
Copy link

@JosepBergay JosepBergay commented Aug 3, 2020

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 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

@JosepBergay JosepBergay commented Aug 3, 2020

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.