I want to run hello world
written on C++ and compiled with Android toolchain 9
, but I faced with issue: by default I have no permissions to launch it a
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.
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.