从 Android 应用程序启动 shell 来运行单独的可执行文件
我想从 android 应用程序启动 shell,因为我想运行一个可执行文件并传递一些参数并期望输出。
我尝试了 ProcessBuilder 并在运行时处理并运行,监听它们的 io 流,但是 android 应用程序不允许我启动 shell,这是权限问题吗?
我一直在得到
runCommand 错误:运行 exec() 时出错。命令:[su] 工作目录:null 环境:null
有没有办法将 shell 作为运行应用程序作为进程与从 shell 启动进程之间的接口来运行?
阐明这个问题,谢谢
I want to start shell from android application because i want to run an executable file and pass few arguments and expect output.
I tried ProcessBuilder and process and run at runtime listening to their io stream but android app does not allowing me to start shell is this permission issue??
I am getting all the time
runCommand error: Error running exec(). Command: [su] Working Directory: null Environment: null
Is there a way to run shell as an interface between running app as a process and process will be started from shell?
Shed some light on this issue thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实际上,当您使用“su” hack 时,您得到的是一个以 root 身份运行的 shell(如果设备已修改为支持该 shell),
如果您不需要 root shell,而是以应用程序的用户 ID 运行的普通 shell ,您可能可以运行 /system/bin/sh 或设备上的任何内容而不是 su。
Actually, when you use the "su" hack what you are getting is a shell that runs as root (if the device has been modified to support that)
If you don't want a root shell but an ordinary one running as your application's userid, you could presumably run /system/bin/sh or whatever it is on your device instead of su.