当我使用此方法request.setDestinationInExternalPublicDir时,我的应用程序停止 我想将下载的文件存储在DIRECTORY_MOVIES中,但它不起作用。 我将CompileSDKVersion更改为25 说它不起作用 这是代码:
public void onNext(String downloadUrl) {
dismissWaitDialog();
String fileName = fmtStreamMap.title + "." + fmtStreamMap.extension;
/*Added By Morad*/
if (fmtStreamMap.extension.contains("mp3")){
Uri uri = Uri.parse(downloadUrl);
DownloadManager.Request request = new DownloadManager.Request(uri);
//request.allowScanningByMediaScanner();
request.setDestinationInExternalFilesDir(MainActivity.this, DIRECTORY_MUSIC, fileName);
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
downloadManager.enqueue(request);
}else{
Uri uri = Uri.parse(downloadUrl);
DownloadManager.Request request = new DownloadManager.Request(uri);
request.setDestinationInExternalPublicDir(DIRECTORY_MOVIES, fileName);
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
downloadManager.enqueue(request);
}
}
我在清单中添加了所有nececcery权限。 这是日志:
04-19 14:46:01.719 5229-5229/dodola.downtube E/SysUtils: ApplicationContext isenter code here null in ApplicationStatus
04-19 14:46:02.160 5229-5229/dodola.downtube E/libEGL: validate_display:255 error 3008 (EGL_BAD_DISPLAY)
04-19 14:46:02.160 5229-5229/dodola.downtube E/libEGL: validate_display:255 error 3008 (EGL_BAD_DISPLAY)
[ 04-19 14:46:02.161 5229: 5229 D/ ]
HostConnection::get() New Host Connection established 0xa3d39e80, tid 5229
04-19 14:46:03.023 5229-5229/dodola.downtube E/DataReductionProxySettingListener: No DRP key due to exception:java.lang.ClassNotFoundException: com.android.webview.chromium.Drp
04-19 14:46:04.621 5229-5335/dodola.downtube E/emuglGLESv2_enc: device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glVertexAttribPointer:291 GL error 0x501
04-19 14:47:03.541 5229-6292/dodola.downtube E/ACodec: [OMX.google.vp9.decoder] storeMetaDataInBuffers failed w/ err -1010
04-19 14:47:03.541 5229-6292/dodola.downtube E/OMXNodeInstance: getParameter(1:google.vp9.decoder, ParamVideoAndroidVp8Encoder(0x6f600007)) ERROR: UnsupportedIndex(0x8000101a)
04-19 14:47:21.734 5229-5335/dodola.downtube E/Surface: getSlotFromBufferLocked: unknown buffer: 0x980de2d0
04-19 14:47:23.877 5229-5335/dodola.downtube E/Surface: getSlotFromBufferLocked: unknown buffer: 0x980de030
04-19 14:47:27.685 5229-5335/dodola.downtube E/Surface: getSlotFromBufferLocked: unknown buffer: 0x980de0a0
04-19 14:47:58.365 5229-5335/dodola.downtube E/Surface: getSlotFromBufferLocked: unknown buffer: 0x9c3c3260
04-19 14:48:19.005 5229-5335/dodola.downtube E/Surface: getSlotFromBufferLocked: unknown buffer: 0x9c3c3260
04-19 14:48:22.455 5229-5335/dodola.downtube E/Surface: getSlotFromBufferLocked: unknown buffer: 0x980de0a0
04-19 14:49:17.740 5229-5335/dodola.downtube E/Surface: getSlotFromBufferLocked: unknown buffer: 0x9c3c3260
04-19 14:49:20.212 5229-5335/dodola.downtube E/Surface: getSlotFromBufferLocked: unknown buffer: 0x980de0a0
04-19 14:49:23.262 5229-5335/dodola.downtube E/Surface: getSlotFromBufferLocked: unknown buffer: 0x980de0a0
04-19 14:49:29.835 5229-5335/dodola.downtube E/Surface: getSlotFromBufferLocked: unknown buffer: 0x980de0a0
04-19 14:49:35.055 5229-5335/dodola.downtube E/Surface: getSlotFromBufferLocked: unknown buffer: 0x980de0a0
04-19 14:49:37.993 5229-5335/dodola.downtube E/Surface: getSlotFromBufferLocked: unknown buffer: 0x980de0a0
我尝试了很多解决办法,但没有任何对我有用;( 请帮我... 谢谢