-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Android instrumentation test packaging fails for mockito-android 3.5.0 with minSdk < 26 #2007
Comments
Should be fixed with #2006 |
We still have issues with 3.5.2. We are unable to update to new version and use
|
@kozaxinan Are you certain that you are using 3.5.2 and aren't accidentally using an older version of either Mockito or ByteBuddy? We have had confirmations from other users that 3.5.2 fixed the issue you are seeing, so it would be good to double check that you have the correct version. |
@TimvdLippe I confirm the issue still occurs also in our project with the exact same error.
|
Looks like the issue was introduced in objenesis 3.x (upgraded in #1998) |
Aha, thanks for letting us know. I will create a revert. |
Still getting this error with 3.5.7 |
Here's the stacktrace that I get when using 3.5.7:
|
I updated all mockito packages to 3.5.9 but unfortunately I do get still the same error as above. |
This still seems to fail for me:
I removed
If you want to test it: nextcloud/android#6768 |
This is still happening in 3.5.10: |
@TimvdLippe looks like
|
@francescocervone That is correct. For non-Android projects, they can use Objenesis 3 just fine. |
@TimvdLippe it's pretty common for Android projects having some pure JVM Gradle modules, not depending on Android. In that case we must depend on Anyway, even if we don't depend directly on
Do you need an example project? |
@francescocervone That last stacktrace is yet another issue that is new to me, as it complains about private interface methods. That seems to be unrelated to Objenesis. The code in question is mockito/src/main/java/org/mockito/plugins/MemberAccessor.java Lines 24 to 28 in b6ae6cf
I guess older versions of Android do not support default interface methods. I am not sure what to do here, as that seems to be a problem where Android did not support all features of Java 8. Since Mockito 3 targets Java 8, that would be incompatible with older versions of Android. Can you use Mockito 2 solely for tests running on older versions of Android? |
No, because this is a compilation error which depends on the minimum supported Android version. Almost every Android project should use Mockito 2 until android 26 will be the "generally accepted" minimum sdk supported version (probably in at least 5 years 😄). |
For anyone who is looking to contribute, please check out the upstream issue at easymock/objenesis#79 |
I am going to close this issue in favor of easymock/objenesis#79 |
I have pushed the changes moving some instantiators in a new project. Could you please check if it works? |
Release 3.2 was done. It should work now. |
This comment has been minimized.
This comment has been minimized.
Release 3.2 of Objenesis was done, Mockito still needs to have its dependency updated to 3.2. This can be worked around by declaring the Objenesis dependency yourself like |
@PaulKlauser Do you mind sending us a PR which updates the version? |
…android (mockito#2024)" This reverts commit 626d457.
…ncompatibility
Could you consider publishing this to Maven as well? |
Mockito 3.9.0 should be published to Maven Central: https://github.com/mockito/mockito/runs/2288011033?check_suite_focus=true |
Thanks! It's still at 3.8.0 on mvnrepository and maven but I suppose it can take several hours for the change to propagate. |
Yes these systems take a while to obtain the new information. 3.9.0 is published here: https://repo1.maven.org/maven2/org/mockito/mockito-core/3.9.0/ |
Just mentioning that I had this exact crash and upgrading to 3.9.0 from 3.8.0 fixed it. However, it might be worth mentioning that any Android project that is just using
|
This required an update in mockito which was indirectly impacted by not having mavenCentral() as a repository as mentioned here mockito/mockito#2007 (comment)
We've upgraded from
mockito-android:3.4.6
tomockito-android:3.5.0
. I'm attempting to package up my instrumented tests by running theassembleAndroidTest
gradle task. The task fails with the following errors:and with root cause:
The text was updated successfully, but these errors were encountered: