100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > android 写入文件失败 Android:写入失败:EPIPE(Broken pipe)写入文件时出错

android 写入文件失败 Android:写入失败:EPIPE(Broken pipe)写入文件时出错

时间:2023-05-12 17:18:30

相关推荐

android 写入文件失败 Android:写入失败:EPIPE(Broken pipe)写入文件时出错

我试图以程序方式截取

Android屏幕截图.我做了以下代码:

private void getsnap(){

try{

Process sh = Runtime.getRuntime().exec("su", null, null);

OutputStream os = sh.getOutputStream();

String filePath = this.getFilesDir().getPath().toString() + "/fileName1.jpeg";

os.write(("/system/bin/screencap -p " + filePath).getBytes("ASCII"));

os.flush();

os.close();

sh.waitFor();

}

catch (Exception e)

{

e.printStackTrace();

}

}

java.io.IOException: write failed: EPIPE (Broken pipe)

请有人帮忙吗?我已经检查过其他帖子,我没有找到任何解决我的问题的东西.

编辑:

请注意,错误发生在os.write()行中.

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。