Android Beaglebone black GPIO APK not functioning

Hi Everybody,
We have with us a BeagleBone Black rev B. We have TI’s pre-built JB 4.2.2 image running on it.

We also have CCSv5 installed on our Ubuntu laptop, and are able to connect and load sample applications on the Bone, using SDK as well as NDK.
For some reason, NDK(or JNI apps) aren’t debuggable, in the sense that execution doesn’t stop at inserted breakpoints.

Now, to control the GPIO’s, we need root access. I’ve read somewhere on this forum that the TI image is already rooted.
Also, through ADB, if for eg ,we want to toggle an LED attached to GPIO, we have to type the following into ADB shell.

root@android:/ # echo 53 > /sys/class/gpio/export
root@android:/ # echo “out” > /sys/class/gpio/gpio53/direction
for LED on
root@android:/ # echo 1 > /sys/class/gpio/gpio53/value
for LED off
root@android:/ # echo 0 > /sys/class/gpio/gpio53/value

We are trying to toggle an LED through an app i.e. apk file. Obviously, we are coding using the SDK. Attached is the app source code.
We referred the source code of ToogleLED.apk available from

Both the files are zipped into one and available at 2 zip files

which is also attached. We have written a very simple app, so that debugging is not a headache, optimization will be done later.

Please see the source code now. We have the following doubts/queries:

  1. In the Manifest file :

These permissions are notified to the user while installing the App. DOES IT MEAN THAT THE APP NOW HAS ACCESS TO THE REQUESTED RESOURCES ?
Or do we have to include some android/java libraries for explicit permission ?

  1. The Android Doc for “android.permission.HARDWARE_TEST” says, from Android Manifest - Hardware
    Allows access to hardware peripherals. Intended only for hardware testing.
    Not for use by third-party applications.
    Is this permission enough for access to GPIO’s ?

  2. from the adb shell we see : " root@android:/ # "
    Does this mean that the image is rooted ?

  3. Most imp. question : Why doesn’t this code work ?
    Refer the functions : “outputLow” and “outputHigh”

  4. Is there a way to access GPIO’s through JNI, i.e. for eg, without using “exec” function(which consumes time) ?

  5. Is there anyone here who has a fully functioning app written. Can you share the source code so that we can compare and learn ?

Bumping this thread

You must be new here, you don't bump "email" threads because no one
answered you in the 9 hours. Either no one replied because they don't
have an interest in the topic, or they haven't read it yet. So don't
bump emails.


Hi, I made this Library “ALLToolKit” for android, using JNI (where it was necessary) you don’t need to use JNI for GPIO control:

with this library you can control GPIO,I2C,SPI,UARTS,PWM,ADC (you need Robert Nelson’s 3.8 kernel for PWM and ADC), you will find an example for GPIO and a script for GPIO initialization.

no more “bumping” please