Is there a way to run a binary executable file (compile with NDK), on Android?
/* #includes #defines ... */
int main(){
// Do something when this is executed
return 0;
}
I want it to run independant from the VM. As in not inside an activity, just a binary that runs directly on the proc
adb push exename /data/bin/exename
#next line might be needed if you are developing on Windows
adb shell chmod 777 /data/bin/exename
adb shell /data/bin/exename
But your device has to be rooted. (It also works on emulator.)
I am answering to your doubt in the first answer mentioned by Andrey.
Try the codes given by him.
adb push exename /data/bin/exename
It is used to push the binary file named 'exename' to the execuatable path on Android.
adb shell chmod 777 /data/bin/exename
This line is not required in linux. Its used to change the mode. The first 7 stands for 'user', next for 'group' and the last for 'other'. Changing the numbers would CHange the MODe of each group mentioned above. 7 represents - read, write and execute. 6 represents - read, write and NO execute.
adb shell /data/bin/exename
This code is used to execute the binary. Which inturn means that its being used in the Terminal.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With