Hello i have 2 questions one about compilation and...
# kotlin-native
m
Hello i have 2 questions one about compilation and another about tests : 1) when your shared code is compiled with kotlin native for android does it use jvm or other thing? 2) I tried mockk to unit test my shared code but i saw recently that when you launch it through android studio it use jvm so i'm wondering what is the good way to test shared code for ios and android?
a
When you use Kotlin/Native compiler, you are producing native code, like when you code on the C/C++ for Android. But because of shared code mention in your text, it is possible that you mean the Kotlin/MPP paradigm. If this is true, there would be two different ways to target Android. On the one hand, one can target it as
android
, which uses JVM. On the other one, you can specify
androidNative
target, that would be compiled by Native, just like I explained earlier. Also, I recommend you to check this part of the documentation(https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#supported-platforms).
m
so when i use fromPreset(presets.android, 'android') in my gradle it uses JVM?
đŸ‘Œ 3
t
Mockk and other mocking libraries doesn't support native unfortunately
m
@thevery so when i use mockK inside my commonTest, launching unit test through android studio execute it with jvm that’s why it works?
t
Yes