执行 logcat 命令引发的EBUSY device or resource busy
来源:互联网 发布:淘宝发布宝贝没有品牌 编辑:程序博客网 时间:2024/05/22 06:32
因项目需要,在程序初始化时,执行 logcat 命令,将收集的日志都输出到 指定文件中,代码如下:
Runtime.getRuntime().exec("logcat -v long -f " + file.getPath());
一般机型都正常,包括在文件管理软件中删除 file 对应的路径之后,再运行程序都正常; 但是某些机型(如 一加
A0001),如果在文件管理软件中删除 file 对应的路径之后,再运行程序会报EBUSY device or resource busy
解决方法:
执行 Process 的 exec 方法时,将其生成的 Process 保存起来,当退出程序时,将 Process destroy 掉
问题产生的可能原因:
注意:未找到确凿证据证明此结论,只是揣测可能是以下原因
一般机型,如果程序退出,那么此程序所在进程(Process A)通过 Runtime 的 exec 说生成的进程(Process a)都会自动停掉;但是像 一加手机这种自定义的系统,因修改了系统的源码,未让 Process a 停掉,所以其会一直占用 file (资源),造成 EBUSY
0 0
- 执行 logcat 命令引发的EBUSY device or resource busy
- open failed: EBUSY (Device or resource busy)
- Android 删除再创建导致open failed: EBUSY (Device or resource busy)
- android java.io.IOException: open failed: EBUSY (Device or resource busy)
- android 删除文件错误:open failed: EBUSY (Device or resource busy)
- 进行删除文件操作时碰到错误:open failed: EBUSY (Device or resource busy)
- Device or resource busy
- Device or resource busy
- 安卓文件安全删除问题 --- java.io.IOException: open failed: EBUSY (Device or resource busy) (System.err)
- hexo到github时 FATAL EBUSY:resource busy or locked
- mount device or resource busy
- 加载驱动模块时Device or resource busy的解决方法
- 加载驱动模块时Device or resource busy的解决方法
- 关于BUG的那些事儿-Device or resource busy
- module编程 Device or resource busy
- rmmod 时出现device or resource busy
- ERROR: Removing '': Device or resource busy
- ERROR: Removing '***': Device or resource busy
- 图片库优化
- ubuntu 14.04中elasticsearch 2.3 + nginx
- Git 提交模板 Commit Template
- 打砖块Demo
- Android ScrollView和OnTouch冲突解决(最新)
- 执行 logcat 命令引发的EBUSY device or resource busy
- unity3d_坦克射炮弹
- Spark基础入门(三)--------作业执行方式
- 超强执行力提升
- mvc:interceptors 完全拦截问题
- Linux命令之ls命令详解
- u-boot怎样生成spl
- 初学者学习python
- 个人记录-LeetCode 84. Largest Rectangle in Histogram