Run a native C program on unrooted Android device

android, c

Solution

I found a solution that works for me - it seems that `/data/local/tmp` is writable, and it isn't on a `noexec` partition.

The solution requires using `adb`. I connected the phone through USB, and I enabled USB debugging from developer options.

Then I uploaded the file to the phone using:

adb push C:\Workspace\hello_world\libs\armeabi\hello_world /data/local/tmp/hello_wo
rld

Then I ran adb shell:

adb shell

And from it I changed the write permission, and ran it:

chmod 755 /data/local/tmp/hello_world
/data/local/tmp/hello_world

Problem

I've managed to build a native executable for Android, after reading How do I build a native (command line) executable to run on Android?, but I can't execute it on my unrooted phone, it gives /system/bin/sh: /storage/sdcard0/Download/hello_world: can't execute: Permission denied because the SD card is mounted with `noexec`, and I can't write anywhere else.

Original source

Related problems