android - 如何解决 java.io.IOException: No such file or directory or Permission denied issue on execution sh file from android in windows machine
问题描述
我需要使用 android 程序中的命令行选项执行 sh 文件。我尝试使用 Runtime.getRuntime().exec。我试图将命令作为字符串以及字符串 [] 传递。但问题仍然存在。我已经在清单文件中授予了在外部存储中读写的权限。
我尝试使用诸如
- getContext().getFilesDir() +
- “/数据/用户/0//文件/...”
- Environment.getExternalStorageDirectory() +
- 我们系统中的路径,例如 C:\Users\...
我尝试使用 cp、rm、ls....以及我实际需要的命令.. 对于上述所有试验,发生了 IO 异常。(权限被拒绝或没有这样的文件或目录)
你能知道一个可能的解决方案来摆脱这个错误并在 android 程序中使用命令行执行 sh 文件。
先感谢您
解决方案
推荐阅读
- java - 如何删除 dankito/RichTextEditor for Android 中的工具栏按钮
- java - 对数组排序的 subArrayLeftShift 方法的最小调用(面试问题)
- c++ - 循环比较(优化)
- django - 如何在 django 管理面板中访问 Google Analytics?
- java - javax.validation.UnexpectedTypeException 使用 Spring ConstraintValidator 进行枚举
- performance - 如何将 SQL 查询中的 Row_number() 转换为 LINQ to Entities 查询
- node.js - 按照命令 npm i npm 更新节点时出错
- ios - 与名为 com.apple.commcenter.coretelephony.xpc 的服务的连接已失效
- amazon-web-services - AWS Lambda 错误没有名为“StringIO”的模块或没有名为“StringIO”的模块
- ios - 使用内置 iOS 日历以编程方式快速创建日历/访问