如何运行C ++中的Android应用程序SHELL [英] How to run C++ application in Android SHELL
问题描述
我要运行的Hello World
写在C ++和汇编与的Android工具链9
,但我面临的问题:默认情况下,我没有权限来启动它并使用chmod`我不能更改权限
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 and I can't change permissions using chmod`.
我用的Android 2.3.3 - API级别10
应用程序是由交叉编译器编译为 API 9级
Application was compiled by cross compiler for API level 9
步骤:
编译应用程序:
〜/ toolchain_andr9 /斌/ ARM-Linux的androideabi-G ++ helloworld.cpp
~/toolchain_andr9/bin/ arm-linux-androideabi-g++ helloworld.cpp
然后发送申请到SD卡上的模拟器:
Then send application to SDCARD on the emulator:
>adb push a.out /mnt/sdcard
然后进入SHELL,并尝试运行的a.out
:
>adb shell
>
>/mnt/sdcard/a.out
和结果是:
>`/mnt/sdcard/a.out: permission denied`
命令的ls -l </ code>显示的a.out为
权
:
>`----rwxr-x system sdcard_rw 863656 2012-04-12 22:42 a.out`
我试图更改权限:
I tried to change permissions:
>chmod 777 /mnt/sdcard/a.out
但权限不会更改:
But rights don't change:
>`----rwxr-x system sdcard_rw 863656 2012-04-12 22:42 a.out`
我想我已经采用了android留下了一些重要的东西。
I think I have left some important thing using android.
可能有人帮助我,给我一个方法如何运行的'应用软件Android的壳呢?
Could anybody help me and give me a way how to run application in `Android SHELL?
非常感谢。
P.S。对不起我的英语=)
P.S. sorry for my English =)
推荐答案
默认情况下,SD卡安装使用选项 NOEXEC
,那就不允许任何文件的执行卡,不管那是什么权限(甚至 -rwxrwxrwx
),所以你需要将文件移动到另一个位置,然后执行它。
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.
最简单的是将文件移动到 /数据/本地的/ tmp /
,并使用完整的路径(通常POSIX PATH语义)执行它。
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
此的不需要的的root访问权限和幸存 重新启动的
这篇关于如何运行C ++中的Android应用程序SHELL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!