Hacker News new | ask | show | jobs
by tommyage 1405 days ago
C# can be natively compiled, doesn't it?
1 comments

Codename One lets you do that with Java. Even more so since native on Android is Java...
I'm not sure I would say Java is native on Android. Sure, most Android apps run on the JVM, but it's not strictly necessary. Google has even released a Native Development Kit that lets you write code in C/C++.

https://developer.android.com/ndk/

This works through JNI. It will work fine as long as you don't use Java/Kotlin stuff. Then you will need to traverse back into the running VM. That has a serious overhead of going in/out of the VM. Since the Android UI is built in Java C code that tries to work with it is slower.

Notice that this isn't true for games which interact with the hardware directly in C. Only for high level UI stuff.

Sure. My point is, the hardware is not directly executing Java bytecode, so I don't think I would say Java is native to Android in the traditional sense of the word. Google themselves make the distinction between Java code and native code.