我想从 android 应用程序启动 shell,因为我想运行一个可执行文件并传递几个参数并期望输出。
我尝试了 ProcessBuilder 并在运行时处理并运行以监听他们的 io 流,但 android 应用程序不允许我启动 shell,这是权限问题吗?
我一直在努力
runCommand error: Error running exec(). Command: [su] Working Directory: null Environment: null
有没有一种方法可以将 shell 运行为作为进程运行的应用程序和将从 shell 启动的进程之间的接口(interface)?
对这个问题有所了解,谢谢
最佳答案
实际上,当您使用“su”hack 时,您得到的是一个以 root 身份运行的 shell(如果设备已被修改以支持它)
如果您不想要一个 root shell,而是一个普通的 shell 作为您的应用程序的用户标识运行,您大概可以运行/system/bin/sh 或您设备上的任何它而不是 su。
关于android - 从 Android 应用程序启动 shell 以运行单独的可执行文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7264968/