-
Notifications
You must be signed in to change notification settings - Fork 53
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
Minimum SDK < 24 and coreLibraryDesugaring causes NoSuchMethodError in ConcurrentHashMap #225
Comments
I've reopened this issue primarily to ask if this is expected behavior. Is a |
Thanks for bringing this up. The two test failure messages seem unrelated to each other, let's tackle them one by one. The As for the second error, it's weird that you'd need the explicit |
Ahhh I tried it while removing the |
I'm assuming that L8's rewriting of core Java classes for maintaining Android compatibility clashes with the JUnit 5 stuff that uses the actual Java classes. By giving a higher What I'd like to know is: If you use Edit: Re-read the question just now. You're saying that your tests execute fine from within AS, but fail from command line. What's the Gradle task you use to run from command line? Maybe the task graph is different between the two, and Android Studio has some internal knowledge of running the desugaring whereas the command line does not. |
After more experimentation, I am convinced that this behavior is a bug inside the Android Gradle Plugin and/or L8 desugaring stack. I have raised an issue on the Google bug tracker for it and will lock down this ticket until there is some feedback from the Android team. |
Having the same issue on Arctic Fox, AGP worked with failed with included the log here, in case you need this
|
However setting Minimum SDK to API 26 also resolve the issue |
Thanks @shawnthye! This does reflect the behavior that I've seen when the minimum SDK is below 26. The desugaring part of the Android Gradle Plugin doesn't kick in for this method if Unfortunately I haven't heard back from the ticket on the Google issue tracker above, causing this to remain at stalemate for the time being. |
yea @mannodermaus , seem like only for Library module @alexsullivan114 error also written with some package name 😄 |
Any progress on this? I encountered the same issue, and switching from JUnit5 to JUnit4 fixed it, without any other changes. |
Nothing to share, sorry. Feel free to star the ticket on the Google issue tracker (linked above) to give some visibility to it. It's not in the realm of possibility for the plugin to address this problem, unfortunately. |
I found this line in the release notes of the desugaring library 1.2.0:
Sounds promising. Note to self to check out this particular issue against version 1.2.0! |
JLYK, v1.2.0 fixes the issue. Though, if after upgrade and running your tests you see another error: |
Thanks for letting me know and the additional pointer, @kronstein! Kind of unfortunate that there doesn't seem to be a good way to backport that second fix to the |
First off, I want to thank the maintainers of this repo for doing the herculean work of getting JUnit 5 up and running on Android!
I'm running into an issue where I can run my instrumentation tests just fine within Android Studio, but if I try to run them from the command line I get two sets of errors.
First off, these are the errors I'm seeing:
First error:
Second error:
The second error is repeated for each class in my
androidTest
folder.Here's the
build.gradle
for the module I'm attempting to test:The errors I'm seeing are awfully close to the errors in this stack overflow post, but we're not using Kotlin so the proposed solution doesn't work for us (unless the issue is some library we're using is using Kotlin under the hood?)
Any help anyone could be provide would be much appreciated. Thank you!
EDIT: Tried to add Kotlin to the project so I could specify the
jvmTarget
in thekotlinOptions
block and add a dependency on the jdk8 standard library as outlined in the linked StackOverflow post but alas no luck.EDIT: It looks like updating the
minSdk
to >= 24 fixes the issue.The text was updated successfully, but these errors were encountered: