W / DownloadManager(7621):中止下载请求11:

时间:2012-10-19 03:36:34

标签: android ioexception download-manager

E/UpdatesSettings( 7146): File write failed: java.io.IOException: open failed: EBUSY (Device or resource busy)
I/DownloadManager( 7621): Initiating request for download 11
W/DownloadManager( 7621): Aborting request for download 11: while opening destination file: java.io.FileNotFoundException: /storage/sdcard0/sysupdater/***.partial: open failed: EBUSY (Device or resource busy)
D/DownloadManager( 7621): cleanupDestination() deleting /storage/sdcard0/sysupdater/***.partial

我使用DownloadManager下载文件,有时它会像这样出现。谁能告诉我为什么以及如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

我遇到过类似的问题。

要避免FileNotFoundException,请确保:

  1. 添加写入外部存储所需的权限(如果您正在尝试保存),请将以下内容添加到AndroidManifest.xml中:

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    
  2. 创建您尝试下载的子文件夹:

    File folder = new File(FOLDER_PATH);
    if (!folder.exists()) {
        folder.mkdir();
    }