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
Andriod API < 24 -> NoClassDefFoundError: Failed resolution of: Ljava/util/Optional; #2075
Comments
Is this a duplicate of #2007? |
I think it's something different because we're seeing a very similar issue and have pinned the version of We have the following hierarchy; Run all tests in project; Two test classes fail to create mocks of InterfaceA, with Using 3.4.6 all tests pass in all three scenarios. We've create a workaround which is to create a fake class which implements InterfaceA and then mock that, which works in 3.5, but it seems a nasty hack. When I was creating the fake I did see a |
@TimvdLippe this is because Mockmaker is using
If you want to support API 23 and older on Android, with |
* bump libraries * Mockito fix: spy not supported for api < 24 (mockito/mockito#2075 (comment)) * Remove duplicated kotlin_version * reference kotlin version from versions.properties file
I am closing this as WontFix, since Android API level 23 was released over 6 years ago. For older Android APIs, we suggest users to stick to Mockito 2. With Mockito 3, we require Java 8, which has similar limitations to the Android ecosystem with respect to API level. |
With
mockito-android
3.5.15
on Android API 23 we are getting this error below, it works fine with3.4.6
Turning on
coreLibraryDesugaring
would likely fix this for API 23, but that might not be a viable option for all builds.https://developer.android.com/studio/releases/gradle-plugin#j8-library-desugaring
java.util.Optional
wasn't added to Android until API 24 (see the Android docs for which API level a given class or method was added in):https://developer.android.com/reference/java/util/Optional
Stacktrack.
The text was updated successfully, but these errors were encountered: