Register
Handmade Hero»Forums»Code»Building Java-free code for Android in C
34 posts

I am fully functional, programmed in multiple techniques.

Building Java-free code for Android in C
3 months ago Edited by k2t0f12d on May 12, 2020, 10:28 a.m. Reason: Initial post
You may find this repo very interesting:

https://github.com/cnlohr/rawdrawandroid

Disclaimer from the README.md

A little bit of this also has to do to stick it to all those luddites people on the internet who post "that's impossible" or "you're doing it wrong" to Stack Overflow questions... Requesting permissions in the JNI "oh you have to do that in Java" or other dumb stuff like that. I am completely uninterested in your opinions of what is or is not possible. This is computer science. There aren't restrictions. I can do anything I want. It's just bits. You don't own me.

I could be chasing an untamed ornithoid without cause
Mārtiņš Možeiko
2109 posts / 1 project
Building Java-free code for Android in C
3 months ago
I have such repo too: https://github.com/mmozeiko/android-native-example With bat file for building.

The disadvantage of going this route is that you won't be able to use any Android API functionality that requires inheriting any interface for some functionality. You can call create Java objects and call their methods through JNI just fine. But once you need to pass some kind of callback as inherited interface - you're out of luck, JNI does not cover that. Then you need to write some Java code.
483 posts
Building Java-free code for Android in C
3 months ago Edited by ratchetfreak on May 13, 2020, 11:02 a.m.
though that can be as simple as a class per interface where each function is a native function with the real meat in JNI. Add a private long for a pointer to the JNI data and you are set