Writing Android Apps In C, No Java Required

Older Android devices can be had for a song, and in many cases are still packing considerable computational power. With built in networking, a battery, and a big touch screen, they could easily take the place of a Raspberry Pi and external display in many applications. As it so happens, Google has made it very easy to develop your own Android software. There’s only one problem: you’ve got to do it in Java.

Looking to get away from all that bloat and overhead, [CNLohr] set out to see what it would take to get 100% C code running on an Android device. After collecting information and resources from the deepest and darkest corners of the Internet, he found out that the process actually wasn’t that bad. He’s crafted a makefile which can be used to get your own C program up and running in seconds.

We mean that literally. As demonstrated in the video after the break, [CNLohr] is able to compile, upload, and run a C Android program in less than two seconds with a single command. This rapid development cycle allows you to spend more time on actually getting work done, as you can iterate through versions of your code almost as quickly as if you were running them on your local machine.

[CNLohr] says you’ll still need to have Google’s Android Studio installed, so it’s not as if this is some clean room implementation. But once it’s installed, you can just call everything from his makefile and never have to interact with it directly. Even if you don’t have any problem with the official Android development tools, there’s certainly something to be said for being able to write a “Hello World” that doesn’t clock in at multiple-megabytes.

32 thoughts on “Writing Android Apps In C, No Java Required

  1. Noice, might have to play with this to see if I can get myself a port of DOSbox that I don’t hate… they all do some (un)helpful keyboard tomfoolery, among other issues. Also need latest version to fix incompatibility with a game I like.

  2. Hmm, interesting post, thanks.
    Unfortunately I’m so habituated & practiced as in dead easy to visualise too in Basic, Pascal or 8 bit assembler like z80, 8051 series still current from silabs & occasional Motorola 68705 series.

    So is there a way to write “apps” in basic or Pascal preferably compiled, though interpreter tolerable ?

    1. This looks surprisingly possible. freepascal has an LLVM output, which can target clang, the compiler used for building these android apps. So… while you would need a little bit of C glue code, it looks like almost everything is achievable in Pascal.

  3. Weird. I had no idea this level was possible. It looks like he’s basically using JNI for all the interfaces, but without providing his own Java code for the wrapper. I’m not sure I like it but it definitely opens some possibilities.

    1. i could never get used to python. its just too wierd. take away my curly braces and im completely lost. im fine with c and c++ though. only interpreted language i really like to use is lua. its really great at making fast and dirty gui apps for talking to arduinos. as its very good at text processing io over a serial terminal (pattern matching features in the strings library are awesome).

      1. I initially had a hard time with Python being a C/C++/C# programmer. And the lack of effective in-line debugging like VS has was a real problem for me. I also thought the VS gui generation is leagues beyond Python. But I got used to it. Just takes a little longer to debug code.

  4. It makes me very happy that someone has done this. Android development stinks because Java (Also known as the second least efficient programming language in existence, second only to Befunge-93) and using C/C++ will be great!
    I can’t wait for someone to reverse-engineer the Billing API for this…

  5. well tickle me pink! I’ve done C for over 20 years, mainly doing gui stuff with GTK etc. but this looks very interesting and very promising. I have questions…. one, would a project of this be able to use glib? I don’t know, just a question. I’m still going to use this and yes I code for ESP8266! got a cool project working right now, on using its networking abilities with arduCam. I am looking forward to using this in my project. ;)

Leave a Reply to zoobabCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.