java.io.IOException:open failed:android中的EBUSY(设备或资源忙)

时间:2014-12-25 05:46:43

标签: android file android-sdcard

我正在使用默认相机在SD卡中创建文件并将图像文件存储在其中。 这很好。

但是从2天开始我就得到了

的例外情况
`12-25 11:50:59.328: W/System.err(5063): java.io.IOException: open failed: EBUSY (Device or resource busy)
12-25 11:50:59.328: W/System.err(5063):     at java.io.File.createNewFile(File.java:946)
12-25 11:50:59.328: W/System.err(5063):     at java.io.File.createTempFile(File.java:1011)
12-25 11:50:59.328: W/System.err(5063):     at tv.caseguard.swipe.fragment.CameraPhoto.setImageUri(CameraPhoto.java:414)
12-25 11:50:59.328: W/System.err(5063):     at tv.caseguard.swipe.fragment.CameraPhoto.dispatchTakePhotoIntent(CameraPhoto.java:380)
12-25 11:50:59.328: W/System.err(5063):     at tv.caseguard.swipe.fragment.CameraPhoto.onClick(CameraPhoto.java:295)
12-25 11:50:59.328: W/System.err(5063):     at android.view.View.performClick(View.java:4438)
12-25 11:50:59.328: W/System.err(5063):     at android.view.View$PerformClick.run(View.java:18422)
12-25 11:50:59.328: W/System.err(5063):     at android.os.Handler.handleCallback(Handler.java:733)
12-25 11:50:59.328: W/System.err(5063):     at android.os.Handler.dispatchMessage(Handler.java:95)
12-25 11:50:59.328: W/System.err(5063):     at android.os.Looper.loop(Looper.java:136)
12-25 11:50:59.328: W/System.err(5063):     at android.app.ActivityThread.main(ActivityThread.java:5017)
12-25 11:50:59.328: W/System.err(5063):     at java.lang.reflect.Method.invokeNative(Native Method)
12-25 11:50:59.328: W/System.err(5063):     at java.lang.reflect.Method.invoke(Method.java:515)
12-25 11:50:59.328: W/System.err(5063):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
12-25 11:50:59.328: W/System.err(5063):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
12-25 11:50:59.328: W/System.err(5063):     at dalvik.system.NativeStart.main(Native Method)
12-25 11:50:59.328: W/System.err(5063): Caused by: libcore.io.ErrnoException: open failed: EBUSY (Device or resource busy)
12-25 11:50:59.328: W/System.err(5063):     at libcore.io.Posix.open(Native Method)
12-25 11:50:59.328: W/System.err(5063):     at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
12-25 11:50:59.338: W/System.err(5063):     at java.io.File.createNewFile(File.java:939)
12-25 11:50:59.338: W/System.err(5063):     ... 15 more
`

我的代码部分

try {
        _imageFileName = "Image_"+_timeStamp;
        _image = File.createTempFile(_imageFileName,".png", fileImage);
        imgUri = Uri.fromFile(_image);
        _imagePath = _image.getAbsolutePath(); // _video is file to send and _videoPath is string path
        System.out.println("Image path on sd card=" + _imagePath);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:-3)

现在为时已晚,但可能会解决他人的问题。 SO中已有答案。我没有遇到像你这样的问题,所以没试试。

访问该链接 open failed: EBUSY (Device or resource busy)