Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Android NDK Native Program Launcher

An Android application which allows to execute native program built by ndk-buld.

Please read this article for more details:


NativeLauncher screenshot


  • Do not require ROOT permission. Enabling native program execution on non-rooted devices.
  • Allows to run native code without USB cable and ADB. This is very important for some special purpose, for example, if we want to measure power consumption of the devices when running the native code, we don't want to connect USB cable which will provide power to the device.
  • Help debug native code before porting it using JNI code in an Android app.


  • Support loading native program from sdcard.
  • Support command line arguments.
  • Allow the user to set up LD_LIBRARY_PATH.
  • Support subfolders. Input files and configurations loaded by the native program can be put in subfolders, in the native program, use relative path to access them.
  • Support output files. Output files can be retrieved from the working directory.


  • Install is simple. Download the apk file under android_apk, and install it on your Android device. Then you are good to go.


  1. Copy your native program (compiled by ndk-build) in a folder on your sdcard, e.g. /sdcard/test/.
  2. Copy all dependent shared libraries (.so) to that folder.
  3. Copy input files to the same folder.
  4. Press the button "Load native program".
  5. Set command line arguments if there is any.
  6. Press button "Run" to execute the program.
  7. Check results under your folder, such as /sdcard/test/.


  1. Q: Where is the working directory?
  • A: The working directory is the directory the executable located.
  1. Q: How to set LD_LIBRARY_PATH? What is the library loading order?
  • A: In the textedit field, type your custom library path. Please notice that, your working directory will be added to LD_LIBRARY_PATH automatically. For example, if you type "mylib" in the field, the LD_LIBRARY_PATH will be set as LD_LIBRARY_PATH=mypath:working_directory:$LD_LIBRARY_PATH.
  1. Q: How to use subfolder?
  • A: Subfolder can be accessed via relative path. For example, if we have a folder named "image" in working directory containing an input image "lena.png", in your code, you can access it via image/lena.png. Your output files will also be under the working directory.
  1. Q: I was not able to load the binary after I clicked "Load Native Program" button?
  • A: On some devices (especially some factory testing devcies), there is no default file explorer. Please install one from the Google Play Store. Basically, any file explorer can do the job. The "ES file explorer" is a good one to start, if you have no preference.


Two examples are provided to demonstrate the usage of native program launcher. Pre-compiled binaries are provided under bin folder. But you can also compile them using ndk-bulid.

  1. Compile the examples with Android NDK:
  2. Have ndk installed and ndk-build is in the system path.
  3. in shell, run ./ Then you have the binareis in bin folder
$ cd examples
$ ./
  1. example1 shows basic usage, and command line arguments. You can set up command line arguments, and they will be displayed one by one.
  2. example2 shows the case where we have executable file along with shared library.


Copyright 2015 Guohui Wang

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.


An Android application which allows to execute native NDK program.







No releases published


No packages published