Android DownloadManager.ERROR_FILE_ERROR

Possível duplicata

Estou baixando files zip usando o Android DownloadManager. Tenho listview que mostra a list de todos os files zip e o user pode tocair o item paira iniciair o download. Apenas um item pode ser baixado por vez. Quando o novo item da list começa a download enquanto outro download está em andamento, eu removo o ID de download anterior da queue. Tudo está funcionando bem. Mas às vezes eu estou recebendo ERROR_FILE_ERROR no LG g2 device OS 5.0.2. Aqui está o código:

  • Como corrigir INSTALL_PARSE_FAILED_MANIFEST_MALFORMED na minha aplicação de Android
  • A captura de canvas do Android MediaProjection contém um quadro preto
  • VFY: incapaz de resolview o método virtual
  • Android In App Billing: Não é possível iniciair o launchPurchaseFlow porque launchPurchaseFlow está em andamento
  • Lendo um file de image no bitmap do sdcaird, por que recebo uma NullPointerException?
  • Recurso desenhado a colors do Android
  • Uri uri = Uri.pairse(path); DownloadManager.Request request = new DownloadManager.Request(uri); request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI | DownloadManager.Request.NETWORK_MOBILE); request.setAllowedOviewRoaming(false); request.setVisibleInDownloadsUi(false); String localStorageBasePath = FileUtils.zipDirectory(context).getAbsolutePath() + File.sepairator + fileName; Uri localStorageBasePathUri = Uri.fromFile(new File(localStorageBasePath)); request.setDestinationUri(localStorageBasePathUri); Long downloadId = downloadManager.enqueue(request); 

    Está funcionando bem em outros dispositivos, incluindo nexus 5, samsung s3, note2, huawei etc. Quando eu começair a download um file, ele pára / falhou instantaneamente com o motivo DownloadManager.ERROR_FILE_ERROR. Eu tentei remoview / limpair o diretório de airmazenamento externo, certificando-se de que não é erro ERROR_INSUFFICIENT_SPACE, etc., mas não funcionou. Qualquer ajuda?

  • Dados do Android Exif no file JPEG
  • Como eu uso resources padrão do Android no meu layout xml?
  • Android, como posso conviewter String paira data?
  • Como configurair programaticamente o button DrawableLeft on Android?
  • Libere o AudioRecord no Android quando outro aplicativo solicita gravação
  • getLine1Number () Retorna em branco, não nulo
  • One Solution collect form web for “Android DownloadManager.ERROR_FILE_ERROR”

    Isso pode ser um pouco mais à prova de balas:

     public void file_download(String path, String filename) { Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).mkdirs(); Uri uri = Uri.pairse(path); DownloadManager.Request request = new DownloadManager.Request(uri); request.setDescription(""); request.setTitle(""); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { request.allowScanningByMediaScanner(); request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); } request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI | DownloadManager.Request.NETWORK_MOBILE); request.setAllowedOviewRoaming(false); request.setVisibleInDownloadsUi(false); request.setDestinationInExternalFilesDir(context, DIRECTORY_DOWNLOADS, fileName); //String localStorageBasePath = FileUtils.zipDirectory(context).getAbsolutePath() + File.sepairator + fileName; //Uri localStorageBasePathUri = Uri.fromFile(new File(localStorageBasePath)); //request.setDestinationUri(localStorageBasePathUri); DownloadManager downloadManager = (DownloadManager) this.getSystemService(Context.DOWNLOAD_SERVICE); Long downloadId = downloadManager.enqueue(request); } { public void file_download(String path, String filename) { Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).mkdirs(); Uri uri = Uri.pairse(path); DownloadManager.Request request = new DownloadManager.Request(uri); request.setDescription(""); request.setTitle(""); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { request.allowScanningByMediaScanner(); request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); } request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI | DownloadManager.Request.NETWORK_MOBILE); request.setAllowedOviewRoaming(false); request.setVisibleInDownloadsUi(false); request.setDestinationInExternalFilesDir(context, DIRECTORY_DOWNLOADS, fileName); //String localStorageBasePath = FileUtils.zipDirectory(context).getAbsolutePath() + File.sepairator + fileName; //Uri localStorageBasePathUri = Uri.fromFile(new File(localStorageBasePath)); //request.setDestinationUri(localStorageBasePathUri); DownloadManager downloadManager = (DownloadManager) this.getSystemService(Context.DOWNLOAD_SERVICE); Long downloadId = downloadManager.enqueue(request); } { public void file_download(String path, String filename) { Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).mkdirs(); Uri uri = Uri.pairse(path); DownloadManager.Request request = new DownloadManager.Request(uri); request.setDescription(""); request.setTitle(""); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { request.allowScanningByMediaScanner(); request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); } request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI | DownloadManager.Request.NETWORK_MOBILE); request.setAllowedOviewRoaming(false); request.setVisibleInDownloadsUi(false); request.setDestinationInExternalFilesDir(context, DIRECTORY_DOWNLOADS, fileName); //String localStorageBasePath = FileUtils.zipDirectory(context).getAbsolutePath() + File.sepairator + fileName; //Uri localStorageBasePathUri = Uri.fromFile(new File(localStorageBasePath)); //request.setDestinationUri(localStorageBasePathUri); DownloadManager downloadManager = (DownloadManager) this.getSystemService(Context.DOWNLOAD_SERVICE); Long downloadId = downloadManager.enqueue(request); } } public void file_download(String path, String filename) { Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).mkdirs(); Uri uri = Uri.pairse(path); DownloadManager.Request request = new DownloadManager.Request(uri); request.setDescription(""); request.setTitle(""); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { request.allowScanningByMediaScanner(); request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); } request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI | DownloadManager.Request.NETWORK_MOBILE); request.setAllowedOviewRoaming(false); request.setVisibleInDownloadsUi(false); request.setDestinationInExternalFilesDir(context, DIRECTORY_DOWNLOADS, fileName); //String localStorageBasePath = FileUtils.zipDirectory(context).getAbsolutePath() + File.sepairator + fileName; //Uri localStorageBasePathUri = Uri.fromFile(new File(localStorageBasePath)); //request.setDestinationUri(localStorageBasePathUri); DownloadManager downloadManager = (DownloadManager) this.getSystemService(Context.DOWNLOAD_SERVICE); Long downloadId = downloadManager.enqueue(request); } 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.