100% C app on Android?

Anyway, can I write 100% native C code for Android? I know there are ways to write C code inside Java code, but I don't know any Java, and I hate Java anyway.

Anyway, can I write pure C code that will run on Android?

+7
source share
4 answers

On Android 2.3: NativeActivity . But you do not get access to any of the intricacies of Android Java libraries; you are on your own in the wild west. It really is for people writing high-performance games.

+9
source

Maybe more problems than it costs, you could write your logic in C code and import it into java using extern or external (I forgot what it is now) and then run the GUI in java. Actually, it makes no sense to use direct C in android unless you really want to optimize your logic. Most of the calls you can make are wrapped up anyway, so you will need to make these calls to access certain things on your Android device. In short: not a good idea unless you need faster logic.

+2
source

You can write most of the application in C around NativeActivity. However, some Android features can only be used with Java, so you need to use JNI instead of pure native. See the official overview .

+2
source

Yes, there is support for writing completely native acts. You can check out the native-activity sample application.

I would not recommend this path, although, as in my experience, applications that are heavy in NDK code are very difficult to debug. I would rate Android's own debugging experience as missing.

Edit - one of the caveats is that you will still be doing from Java only through the JNI.

+2
source

All Articles