设置时应用崩溃 setDestinationInExternalPublicDir()
val videoDir = Environment.getDataDirectory().absolutePath + "/applicationfiles/.tutorial"
downloadRequest.setDestinationInExternalPublicDir(videoDir, videoName)
E / AndroidRuntime:致命例外:主进程:app.package,PID:19275 java.lang.IllegalStateException:不是标准目录之一:android.os.Parcel.createException(Parcel.java:2079/data/applicationfiles/.tutorial )在android.os.Parcel.readException(Parcel.java:2039)在android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:188)在android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:140)在android.content .android.content.ContentProviderClient.call(ContentProviderClient.java:558)上的.ContentProviderProxy.call(ContentProviderNative.java:658),android.app.DownloadManager $ Request上android.content.ContentProviderClient.call(ContentProviderClient.java:546)上的。在app上的app.package.startDownloadingFile(ExerciseTutorialPresenter.kt:159)上的setDestinationInExternalPublicDir(DownloadManager.java:569)。package.downloadVideoFiles(ExerciseTutorialPresenter.kt:142)
setDestinationInExternalPublicDir(dirType: String!, subPath: String!)
对于应用程序指定Android 10以上,所述第一参数dirType
为这个方法必须是已知的公共目录等中的一个Environment.DIRECTORY_DOWNLOADS
,Environment.DIRECTORY_PICTURES
,Environment.DIRECTORY_MOVIES
等。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句