Can I use Kotlin Native to call Android API?

I just found out that Kotlin supports compilation into native code. I wanted to get rid of JVM in my apps as it’s inconvenient. Is it possible to call the Android Java/Kotlin APIs from Kotlin native? If so, can I do an Android app entirely in Kotlin native without any JVM?

If not, is there a push by google into this direction? Android .dex is already ahead of time compiled into native anyways, so why not use Kotlin native for everything?

1 Like

I doubt this is possible on Android. We don’t control, how our application is initialized - it is always started as JVM app. Also, all Android libraries are written in Java and we need to use them in our app. Regarding AOT compilation: correct me if I’m wrong, but we still distribute apps in portable, unoptimized dex format and it is compiled while installing the app. Also, I believe this native dex you mention is not the same as e.g. native code produced by C code. It is “JVM-native” code, it still requires JVM to work.

Anyway, what is inconvenient about JVM?

1 Like