Open adrienrx opened 2 years ago
As stated in the README, the dexmaker-mockito-inline
artifact can only be used on Android P (API 28) and above. The underlying system capabilities to mock static and final code does not exist before that API level.
If you are running on Android 4.4, you should use the regular dexmaker-mockito
artifact instead.
@drewhannay Are you refering to
OS version : 4.4.177-22723052
That's probably referring to my workstation OS, not android. I'm not running 4.4
That would be the kernel verison of the phone I'm running the test on.
Starting in Android "P", it is possible to mock final classes and methods using the dexmaker-mockito-inline library. If you execute your tests on a device or emulator running Android P or above
I don't think I'm breaking the readme recommendation. Am I?
Ah, my apologies. Usually this is the error you get when running on a too old Android version, and I saw 4.4 and assumed 😅
The other thing to check: Do you have any other mockito dependencies in the androidTestImplementation
? Maybe being pulled in transitively through some other dependency? Running ./gradlew :yourModule:androidDependencies
should show you the full graph.
I'm currently OOO - I'll be updating this ticket on the 07/09. Please don't close
Hello,
I am getting an issue when trying to use anything mock related in instrumented test.
AndroidJUnitRunner is default 'testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"'
androidTestImplementation config
jvm is 1.8 + coreLibDesugar up compileSdk is 31 minSdk is 26
I have tried to run tests with AndroidJunit4::class / MockitoJUnitRunner::class / even without a RunWIth (was getting a bit desperate)/
I'm seeing quite a lot of similar issues online.
When using a different set of dependencies, the error changes..