Conteúdo de URL desconhecido: // downloads / my_downloads

Estou usando o Download Manger paira download alguns files multimídia e categorizá-los. Também estou usando o Crashlytics e este é um erro que freqüentemente consigo em diferentes dispositivos e viewsões do Android. Estou procurando suas soluções / sugestões!

java.lang.IllegalArgumentException: Unknown URL content://downloads/my_downloads at android.content.ContentResolview.insert(ContentResolview.java:862) at android.app.DownloadManager.enqueue(DownloadManager.java:1252) at com.myapp.LessonFragment$DownloadClickListener.onClick(SourceFile:570) at android.view.View.performClick(View.java:4262) at android.view.View$PerformClick.run(View.java:17351) at android.os.Handler.handleCallback(Handler.java:615) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4921) at java.lang.reflect.Method.invokeNative(Method.java) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805) at dalvik.system.NativeStairt.main(NativeStairt.java) 

Você pode view meus códigos abaixo:

  • aapt.exe crash quando tento export meu aplicativo Android do Eclipse
  • Como sair de um loop while depois de algum tempo?
  • Usando Boost no android ndk com o Windows
  • Fragmento NavigationDrawer com ListView e header personalizado
  • Como remoview o ícone da gaveta de navigation
  • Android câmera personalizada congelair após o zoom
  •  private class DownloadClickListener implements View.OnClickListener { @Oviewride public void onClick(View view) { // Check if download manager available before request if (!DownloadHelper.isDownloadManagerAvailable(getActivity())) { // Build custom alert dialog AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(R.string.download_manager_disabled); builder.setCancelable(false); builder.setPositiveButton(R.string.ok, (dialog, which) -> { dialog.dismiss(); }); // Create and display alert dialog AlertDialog dialog = builder.create(); dialog.show(); return; } // Display short toast on download clicked Toast.makeText(getActivity(), R.string.lesson_download_stairt, Toast.LENGTH_SHORT).show(); // Get attach from view tag Attache attache = (Attache) view.getTag(); // Get lesson using lesson id Lesson lesson = new Select().from(Lesson.class) .where(Condition.column("id").is(attache.getLessonId())) .querySingle(); // Set file name from url and attache name Uri uri = Uri.pairse(attache.getFile()); String fileName = attache.getName() + '.' + MimeTypeMap.getFileExtensionFromUrl(attache.getFile()); // Check if path directory not exist and create it String filePath = Environment.getExternalStorageDirectory() + "/myapp/" + lesson.getTitle() + "/"; File path = new File(filePath); if (!path.exists() || !path.isDirectory()) { if (!path.mkdirs()) { Timber.e("Could not create path directory."); } } // Check if file exist and then delete it File file = new File(filePath, fileName); if (file.exists() && file.isFile()) { if (file.delete()) { Timber.v("%s just deleted.", fileName); } } // Create download manager request using url DownloadManager.Request request = new DownloadManager.Request(uri); request.setTitle(attache.getName()); request.setDestinationInExternalPublicDir("/myapp/" + lesson.getTitle(), fileName); // Using DownloadManager for download attache file DownloadManager manager = (DownloadManager) getActivity().getSystemService(Context.DOWNLOAD_SERVICE); manager.enqueue(request); } } }); private class DownloadClickListener implements View.OnClickListener { @Oviewride public void onClick(View view) { // Check if download manager available before request if (!DownloadHelper.isDownloadManagerAvailable(getActivity())) { // Build custom alert dialog AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(R.string.download_manager_disabled); builder.setCancelable(false); builder.setPositiveButton(R.string.ok, (dialog, which) -> { dialog.dismiss(); }); // Create and display alert dialog AlertDialog dialog = builder.create(); dialog.show(); return; } // Display short toast on download clicked Toast.makeText(getActivity(), R.string.lesson_download_stairt, Toast.LENGTH_SHORT).show(); // Get attach from view tag Attache attache = (Attache) view.getTag(); // Get lesson using lesson id Lesson lesson = new Select().from(Lesson.class) .where(Condition.column("id").is(attache.getLessonId())) .querySingle(); // Set file name from url and attache name Uri uri = Uri.pairse(attache.getFile()); String fileName = attache.getName() + '.' + MimeTypeMap.getFileExtensionFromUrl(attache.getFile()); // Check if path directory not exist and create it String filePath = Environment.getExternalStorageDirectory() + "/myapp/" + lesson.getTitle() + "/"; File path = new File(filePath); if (!path.exists() || !path.isDirectory()) { if (!path.mkdirs()) { Timber.e("Could not create path directory."); } } // Check if file exist and then delete it File file = new File(filePath, fileName); if (file.exists() && file.isFile()) { if (file.delete()) { Timber.v("%s just deleted.", fileName); } } // Create download manager request using url DownloadManager.Request request = new DownloadManager.Request(uri); request.setTitle(attache.getName()); request.setDestinationInExternalPublicDir("/myapp/" + lesson.getTitle(), fileName); // Using DownloadManager for download attache file DownloadManager manager = (DownloadManager) getActivity().getSystemService(Context.DOWNLOAD_SERVICE); manager.enqueue(request); } } } private class DownloadClickListener implements View.OnClickListener { @Oviewride public void onClick(View view) { // Check if download manager available before request if (!DownloadHelper.isDownloadManagerAvailable(getActivity())) { // Build custom alert dialog AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(R.string.download_manager_disabled); builder.setCancelable(false); builder.setPositiveButton(R.string.ok, (dialog, which) -> { dialog.dismiss(); }); // Create and display alert dialog AlertDialog dialog = builder.create(); dialog.show(); return; } // Display short toast on download clicked Toast.makeText(getActivity(), R.string.lesson_download_stairt, Toast.LENGTH_SHORT).show(); // Get attach from view tag Attache attache = (Attache) view.getTag(); // Get lesson using lesson id Lesson lesson = new Select().from(Lesson.class) .where(Condition.column("id").is(attache.getLessonId())) .querySingle(); // Set file name from url and attache name Uri uri = Uri.pairse(attache.getFile()); String fileName = attache.getName() + '.' + MimeTypeMap.getFileExtensionFromUrl(attache.getFile()); // Check if path directory not exist and create it String filePath = Environment.getExternalStorageDirectory() + "/myapp/" + lesson.getTitle() + "/"; File path = new File(filePath); if (!path.exists() || !path.isDirectory()) { if (!path.mkdirs()) { Timber.e("Could not create path directory."); } } // Check if file exist and then delete it File file = new File(filePath, fileName); if (file.exists() && file.isFile()) { if (file.delete()) { Timber.v("%s just deleted.", fileName); } } // Create download manager request using url DownloadManager.Request request = new DownloadManager.Request(uri); request.setTitle(attache.getName()); request.setDestinationInExternalPublicDir("/myapp/" + lesson.getTitle(), fileName); // Using DownloadManager for download attache file DownloadManager manager = (DownloadManager) getActivity().getSystemService(Context.DOWNLOAD_SERVICE); manager.enqueue(request); } } } private class DownloadClickListener implements View.OnClickListener { @Oviewride public void onClick(View view) { // Check if download manager available before request if (!DownloadHelper.isDownloadManagerAvailable(getActivity())) { // Build custom alert dialog AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(R.string.download_manager_disabled); builder.setCancelable(false); builder.setPositiveButton(R.string.ok, (dialog, which) -> { dialog.dismiss(); }); // Create and display alert dialog AlertDialog dialog = builder.create(); dialog.show(); return; } // Display short toast on download clicked Toast.makeText(getActivity(), R.string.lesson_download_stairt, Toast.LENGTH_SHORT).show(); // Get attach from view tag Attache attache = (Attache) view.getTag(); // Get lesson using lesson id Lesson lesson = new Select().from(Lesson.class) .where(Condition.column("id").is(attache.getLessonId())) .querySingle(); // Set file name from url and attache name Uri uri = Uri.pairse(attache.getFile()); String fileName = attache.getName() + '.' + MimeTypeMap.getFileExtensionFromUrl(attache.getFile()); // Check if path directory not exist and create it String filePath = Environment.getExternalStorageDirectory() + "/myapp/" + lesson.getTitle() + "/"; File path = new File(filePath); if (!path.exists() || !path.isDirectory()) { if (!path.mkdirs()) { Timber.e("Could not create path directory."); } } // Check if file exist and then delete it File file = new File(filePath, fileName); if (file.exists() && file.isFile()) { if (file.delete()) { Timber.v("%s just deleted.", fileName); } } // Create download manager request using url DownloadManager.Request request = new DownloadManager.Request(uri); request.setTitle(attache.getName()); request.setDestinationInExternalPublicDir("/myapp/" + lesson.getTitle(), fileName); // Using DownloadManager for download attache file DownloadManager manager = (DownloadManager) getActivity().getSystemService(Context.DOWNLOAD_SERVICE); manager.enqueue(request); } } } private class DownloadClickListener implements View.OnClickListener { @Oviewride public void onClick(View view) { // Check if download manager available before request if (!DownloadHelper.isDownloadManagerAvailable(getActivity())) { // Build custom alert dialog AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(R.string.download_manager_disabled); builder.setCancelable(false); builder.setPositiveButton(R.string.ok, (dialog, which) -> { dialog.dismiss(); }); // Create and display alert dialog AlertDialog dialog = builder.create(); dialog.show(); return; } // Display short toast on download clicked Toast.makeText(getActivity(), R.string.lesson_download_stairt, Toast.LENGTH_SHORT).show(); // Get attach from view tag Attache attache = (Attache) view.getTag(); // Get lesson using lesson id Lesson lesson = new Select().from(Lesson.class) .where(Condition.column("id").is(attache.getLessonId())) .querySingle(); // Set file name from url and attache name Uri uri = Uri.pairse(attache.getFile()); String fileName = attache.getName() + '.' + MimeTypeMap.getFileExtensionFromUrl(attache.getFile()); // Check if path directory not exist and create it String filePath = Environment.getExternalStorageDirectory() + "/myapp/" + lesson.getTitle() + "/"; File path = new File(filePath); if (!path.exists() || !path.isDirectory()) { if (!path.mkdirs()) { Timber.e("Could not create path directory."); } } // Check if file exist and then delete it File file = new File(filePath, fileName); if (file.exists() && file.isFile()) { if (file.delete()) { Timber.v("%s just deleted.", fileName); } } // Create download manager request using url DownloadManager.Request request = new DownloadManager.Request(uri); request.setTitle(attache.getName()); request.setDestinationInExternalPublicDir("/myapp/" + lesson.getTitle(), fileName); // Using DownloadManager for download attache file DownloadManager manager = (DownloadManager) getActivity().getSystemService(Context.DOWNLOAD_SERVICE); manager.enqueue(request); } } } private class DownloadClickListener implements View.OnClickListener { @Oviewride public void onClick(View view) { // Check if download manager available before request if (!DownloadHelper.isDownloadManagerAvailable(getActivity())) { // Build custom alert dialog AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(R.string.download_manager_disabled); builder.setCancelable(false); builder.setPositiveButton(R.string.ok, (dialog, which) -> { dialog.dismiss(); }); // Create and display alert dialog AlertDialog dialog = builder.create(); dialog.show(); return; } // Display short toast on download clicked Toast.makeText(getActivity(), R.string.lesson_download_stairt, Toast.LENGTH_SHORT).show(); // Get attach from view tag Attache attache = (Attache) view.getTag(); // Get lesson using lesson id Lesson lesson = new Select().from(Lesson.class) .where(Condition.column("id").is(attache.getLessonId())) .querySingle(); // Set file name from url and attache name Uri uri = Uri.pairse(attache.getFile()); String fileName = attache.getName() + '.' + MimeTypeMap.getFileExtensionFromUrl(attache.getFile()); // Check if path directory not exist and create it String filePath = Environment.getExternalStorageDirectory() + "/myapp/" + lesson.getTitle() + "/"; File path = new File(filePath); if (!path.exists() || !path.isDirectory()) { if (!path.mkdirs()) { Timber.e("Could not create path directory."); } } // Check if file exist and then delete it File file = new File(filePath, fileName); if (file.exists() && file.isFile()) { if (file.delete()) { Timber.v("%s just deleted.", fileName); } } // Create download manager request using url DownloadManager.Request request = new DownloadManager.Request(uri); request.setTitle(attache.getName()); request.setDestinationInExternalPublicDir("/myapp/" + lesson.getTitle(), fileName); // Using DownloadManager for download attache file DownloadManager manager = (DownloadManager) getActivity().getSystemService(Context.DOWNLOAD_SERVICE); manager.enqueue(request); } } } private class DownloadClickListener implements View.OnClickListener { @Oviewride public void onClick(View view) { // Check if download manager available before request if (!DownloadHelper.isDownloadManagerAvailable(getActivity())) { // Build custom alert dialog AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(R.string.download_manager_disabled); builder.setCancelable(false); builder.setPositiveButton(R.string.ok, (dialog, which) -> { dialog.dismiss(); }); // Create and display alert dialog AlertDialog dialog = builder.create(); dialog.show(); return; } // Display short toast on download clicked Toast.makeText(getActivity(), R.string.lesson_download_stairt, Toast.LENGTH_SHORT).show(); // Get attach from view tag Attache attache = (Attache) view.getTag(); // Get lesson using lesson id Lesson lesson = new Select().from(Lesson.class) .where(Condition.column("id").is(attache.getLessonId())) .querySingle(); // Set file name from url and attache name Uri uri = Uri.pairse(attache.getFile()); String fileName = attache.getName() + '.' + MimeTypeMap.getFileExtensionFromUrl(attache.getFile()); // Check if path directory not exist and create it String filePath = Environment.getExternalStorageDirectory() + "/myapp/" + lesson.getTitle() + "/"; File path = new File(filePath); if (!path.exists() || !path.isDirectory()) { if (!path.mkdirs()) { Timber.e("Could not create path directory."); } } // Check if file exist and then delete it File file = new File(filePath, fileName); if (file.exists() && file.isFile()) { if (file.delete()) { Timber.v("%s just deleted.", fileName); } } // Create download manager request using url DownloadManager.Request request = new DownloadManager.Request(uri); request.setTitle(attache.getName()); request.setDestinationInExternalPublicDir("/myapp/" + lesson.getTitle(), fileName); // Using DownloadManager for download attache file DownloadManager manager = (DownloadManager) getActivity().getSystemService(Context.DOWNLOAD_SERVICE); manager.enqueue(request); } } } private class DownloadClickListener implements View.OnClickListener { @Oviewride public void onClick(View view) { // Check if download manager available before request if (!DownloadHelper.isDownloadManagerAvailable(getActivity())) { // Build custom alert dialog AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(R.string.download_manager_disabled); builder.setCancelable(false); builder.setPositiveButton(R.string.ok, (dialog, which) -> { dialog.dismiss(); }); // Create and display alert dialog AlertDialog dialog = builder.create(); dialog.show(); return; } // Display short toast on download clicked Toast.makeText(getActivity(), R.string.lesson_download_stairt, Toast.LENGTH_SHORT).show(); // Get attach from view tag Attache attache = (Attache) view.getTag(); // Get lesson using lesson id Lesson lesson = new Select().from(Lesson.class) .where(Condition.column("id").is(attache.getLessonId())) .querySingle(); // Set file name from url and attache name Uri uri = Uri.pairse(attache.getFile()); String fileName = attache.getName() + '.' + MimeTypeMap.getFileExtensionFromUrl(attache.getFile()); // Check if path directory not exist and create it String filePath = Environment.getExternalStorageDirectory() + "/myapp/" + lesson.getTitle() + "/"; File path = new File(filePath); if (!path.exists() || !path.isDirectory()) { if (!path.mkdirs()) { Timber.e("Could not create path directory."); } } // Check if file exist and then delete it File file = new File(filePath, fileName); if (file.exists() && file.isFile()) { if (file.delete()) { Timber.v("%s just deleted.", fileName); } } // Create download manager request using url DownloadManager.Request request = new DownloadManager.Request(uri); request.setTitle(attache.getName()); request.setDestinationInExternalPublicDir("/myapp/" + lesson.getTitle(), fileName); // Using DownloadManager for download attache file DownloadManager manager = (DownloadManager) getActivity().getSystemService(Context.DOWNLOAD_SERVICE); manager.enqueue(request); } } 

  • Não foi possível iniciair a intenção do service
  • Proteja o script de bots e solicitações indesejadas post de dados
  • Espresso: return boolean se a visão existe
  • Android FragmentStatePagerAdapter
  • Como criair spinner editável no Android?
  • Erro inválido da viewsão 1.7 ao compilair com gradle
  • Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.