各位好,刚开始学习android, 现在按照这个网址:http://blog.csdn.net/satiling/article/details/6914466(其实就是安装编译器,然后编译helloworld程序) 把一个helloworld 程序编译成二进制,然后 push到虚拟机中,在终端运行,发现即使我把权限改成 chmod 777 testhello  ,然后./testhello还是提示说:permission denied请问下 这个是怎么回事,谢谢!

解决方案 »

  1.   

    andriod 的环境中是不支持把可执行文件随便放的。 你放在 system/bin 下一般就是可以了或者试试如下方式运行. ./testhello注意第一个. 后面有一个空格
      

  2.   

    谢谢,我试了下,发现 无法放到/system/bin 下面,提说是,这个只读文件系统。
    而我放到/mnt/sdcard后,打印说:# cd sdcard
    # ls
    LOST.DIR
    hell
    # . ./hell
    ./hell: 1: Syntax error: word unexpected (expecting ")")
    暂时不知道为什么?
    我的程序如下:
    #include <stdio.h>
    int main()
    {
       printf("hello world\n");
       return 0;
    }编译语句是:arm-none-linux-gnueabi-gcc helloworld.c -o hell然后是./adb push hell /mnt/sdcard 
      

  3.   

    上网有人说是 adb push 传输过程中出错,可是
    我执行   ./adb push hell /mnt/sdcard
    终端打印是:77 KB/s (5742 bytes in 0.072s)
    而我的hell 正好是5742个字节,感觉传输完了啊!?????无语了~~~~
      

  4.   

    不是传输的问题。 android有限制,不是随便都可执行的。 看init.rc 只有在path中的路径才可以
      

  5.   

    你要执行这个文件需要在/system/bin下面用./<文件名>
    那么你为什么不能运行呢?
    首先,在进adb push之前先设置权限:adb root试试,如果不行那么你在adb push之前设置:adb remount。这样应该就能push进去了。
      

  6.   

    我也遇到了这个问题,请给点提示,谢谢!我看了你的博客,但好像是用ndk编译程序,我想用arm-linux-gcc编译,成吗?