How to run C++ application in Android SHELL How to run C++ application in Android SHELL shell shell

How to run C++ application in Android SHELL


By default, the SD card is mounted with option noexec, that disallows the execution of any file on the card, no matter what it's permissions(even -rwxrwxrwx), so you need to move the file to another location and then execute it.

The easiest is to move the file to /data/local/tmp/ and execute it using the full path (usual POSIX PATH semantics).

> adb push a.out /data/local/tmp/a.out> adb shell> chmod 755 /data/local/tmp/a.out> /data/local/tmp/a.out

This does not require root access and survives reboot.


If you have rooted your phone you can do a mount -o remount,rw /mnt/sdcard and it should run.

I've tried it on my Android.