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.

26 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.

Leave a Reply

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