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

Breaking change in patch 1.16.2: ThreadLocal#withInitial not in android API < 26. #2022

Closed
sixcolors opened this issue Oct 28, 2023 · 1 comment
Labels
duplicate This is a duplicate issue or root-cause of another issue

Comments

@sixcolors
Copy link

sixcolors commented Oct 28, 2023

v1.16.2 introduces a breaking change for older android clients: https://developer.android.com/reference/java/lang/ThreadLocal#withInitial(java.util.function.Supplier%3C?%20extends%20S%3E)

Exception java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done (AsyncTask.java:325)
at java.util.concurrent.FutureTask.finishCompletion (FutureTask.java:354)
at java.util.concurrent.FutureTask.setException (FutureTask.java:223)
at java.util.concurrent.FutureTask.run (FutureTask.java:242)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607)
at java.lang.Thread.run (Thread.java:762)
Caused by java.lang.NoSuchMethodError: No static method withInitial(Ljava/util/function/Supplier;)Ljava/lang/ThreadLocal; in class Ljava/lang/ThreadLocal; or its super classes (declaration of 'java.lang.ThreadLocal' appears in /system/framework/core-oj.jar)
at org.jsoup.internal.StringUtil. (StringUtil.java:338)
at org.jsoup.internal.StringUtil.borrowBuilder (StringUtil.java:348)
at org.jsoup.helper.UrlBuilder. (UrlBuilder.java:30)
at org.jsoup.helper.HttpConnection$Base.url (HttpConnection.java:422)
at org.jsoup.helper.HttpConnection$Request.url (HttpConnection.java:580)
at org.jsoup.helper.HttpConnection.url (HttpConnection.java:138)
at org.jsoup.helper.HttpConnection.connect (HttpConnection.java:78)
at org.jsoup.Jsoup.connect (Jsoup.java:94)

@sixcolors sixcolors changed the title Breaking change in patch 1.16.2: ThreadLocal not in android api < 26. Breaking change in patch 1.16.2: ThreadLocal#withInitial API not in android api < 26. Oct 28, 2023
@sixcolors sixcolors changed the title Breaking change in patch 1.16.2: ThreadLocal#withInitial API not in android api < 26. Breaking change in patch 1.16.2: ThreadLocal#withInitial not in android API < 26. Oct 28, 2023
@jhy
Copy link
Owner

jhy commented Oct 28, 2023

Hi there -- you will need to enable desugaring in your build to bring the Java compatibility up to 1.8. Please see this note from the readme:

Android support
When used in Android projects, core library desugaring with the NIO specification should be enabled to support Java 8+ features.

Happy for feedback on how to make this required setting more obvious!

(Dupes #2000)

@jhy jhy closed this as completed Oct 28, 2023
@jhy jhy added the duplicate This is a duplicate issue or root-cause of another issue label Oct 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This is a duplicate issue or root-cause of another issue
Projects
None yet
Development

No branches or pull requests

2 participants