在我的应用程序中,我试图执行存在于我的SD卡上的本机代码。如何使用Runtime.getRuntime()。exec(“cmd”)
File sdCard = getExternalFilesDir(null); // directory where native file is placed
String nativeFile = "nativeFile";
String cmd = "shell /system/bin/chmod 0777 " + sdCard.getAbsolutePath() + "/" + nativeFile;
Process proc = Runtime.getRuntime().exec(cmd);
但只要Runtime.getRuntime().exec(cmd)
被执行时,它抛出错误:
java.io.IOException: Error running exec(). Command: [shell, /system/bin/chmod, 0777, /storage/emulated/0/Android/data/com.example.andridutilproject/files/native] Working Directory: null Environment: null
任何建议,如何解决这个问题?
没有'shell'可执行文件。你为什么试图运行它? – 2014-10-30 22:22:55