build C C application and run on Android - tingxingdong/clBLAS-private GitHub Wiki

Basically, as far as I know. There are multiple ways to build / run your own developed C/C++ application on Android. For all the ways, you need root privileges. Readers are assumed to know how to connect to your phone to a PC and be familiar with adb tools which is to manipulate your phone by your PC.

Method 1: You need Android Studio (AS) + NDK. You make an APK wrapping your C++ application. You need to deal with Java. adb push you APK to the phone and run as an APP on your phone. You will have a GUI then. This is the most common way. You may found tons of resources for Way 1.

Method 2: Cross compile (which here basically means you compile it on your x86 PC with the target ARM ISA to allow it later run on ARM based phone). You will need NDK toolkit, adb push the executable in to Android phone. You do not need to deal with Java and an APP, but run your executable on command line mode after adb shell (which let u enter the phone). You may not need AS but it is nice to have.

For Method 2.

There are three main ways to build code with the NDK:

(1) The Make-based ndk-build.

(2) CMake.

(3) Standalone toolchains for integration with other build systems, or use with configure-based projects.

Method 3: Most hacked way. No AS + NDK involved. Install like a terminal APP on your phone and "sudo apt-get software" in Android. Build everything in side Android like on a regular Linux. Someone may succeed. But I do not know Method 3.