android8 Runtime.getRuntime().exec su
时间: 2023-12-15 15:44:30 浏览: 212
Runtime 运行时
在Android 8中,您可以使用以下代码来使用su命令:
```
try {
Process process = Runtime.getRuntime().exec("su");
process.waitFor();
} (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) e.printStackTrace();
}
```
这段代码使用`Runtime.getRuntime().exec("su")`来执行su命令,然后使用`process.waitFor()`等待命令执行完成。这样您就可以在Android 8中使用su命令了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [Android Runtime.getRuntime().exec(...),参数带有空格的解决方法](https://blog.csdn.net/qq_38270065/article/details/127071585)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [Android Runtime.getRuntime().exec()](https://blog.csdn.net/xianrenli38/article/details/117484708)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文