https://kotlinlang.org logo
Title
m

mvbrenes

02/10/2019, 10:14 PM
For a while now trying to use the latest version (2.1.0)
Mockito-Kotlin
has been a pain if you are using the Android
Jetitfier
. The library relies on a version of Mockito which has an updated version (1.9.0) of
Byte-buddy
who is the real culprit here. I was able to resolve this by adding:
android.jetifier.blacklist=byte-buddy
to my
gradle.properties
file, now i can happily move on without forcing certain versions of Mockito or excluding libraries which gets kind of hairy when you have a lot of modules and dependencies. Posting this here in case if helps anyone else 🙂
👍 4
a

arekolek

02/11/2019, 9:06 AM
What versions are we talking about? (latest now is not going to be latest in the future 😛 )
j

Jay

02/11/2019, 1:18 PM
So I’ve just added mockito-kotlin to use with KotlinTest and I’m not having any issues so far… I’m only an Android beginner, so not doing much with it yet, but I’ve written some sample tests using various mockito functions to learn mockito, and make sure it’s all working. I do have
useAndroidX
and
enableJetifier
as true, and all seems fine.
…if I do hit this issue though, how will I know? Is there a specific error I’ll see?
p

plastiv

02/11/2019, 5:04 PM
@mvbrenes I'm interested in this as well. Recently made a push for androidX conversion. Been using mockito-android, didn't notice any issue. (although there was a bit of headache after migrating to compileSdk28 and running android tests on emulator v28)
Could you share which versions of mockito, mockito-kotlin, byte-buddy and jettifier were conflicting, please?
m

mvbrenes

02/11/2019, 6:21 PM
I had trouble when using
version 2.1
, I will post an example of the build error I encountered when trying to assemble the tests later today. the way I was getting around the build error was to force
Mockito version 2.22.0
as anything after that I was unable to run without issues
A while back I had tried to report the issue to the Google team here: https://issuetracker.google.com/issues/118842038 There are more details in the stack trace as well as a link to the GitHub issue that was reported for
Byte-Buddy
p

plastiv

02/11/2019, 10:37 PM
Thanks 👍