android-multipicker-library: FileUriExposedException
When I use CameraImagePicker pickImage() on Android 7.0 (N) on Nexus 5x, with an app targeting/compiling SDK 24, I have
D/ImagePickerImpl: Temp Path for Camera capture: /storage/emulated/0/AppName/AppName Pictures/061aafec-0acd-488d-b8b0-c7d5fb8c152a.jpg
E/FileUpload: <AppNameFilesChooser.java:151> FileUriExposedException: android.os.FileUriExposedException: file:///storage/emulated/0/AppName/AppName%20Pictures/061aafec-0acd-488d-b8b0-c7d5fb8c152a.jpg exposed beyond app through ClipData.Item.getUri()
W/System.err: at android.os.StrictMode.onFileUriExposed(StrictMode.java:1799)
W/System.err: at android.net.Uri.checkFileUriExposed(Uri.java:2346)
W/System.err: at android.content.ClipData.prepareToLeaveProcess(ClipData.java:832)
W/System.err: at android.content.Intent.prepareToLeaveProcess(Intent.java:8909)
W/System.err: at android.content.Intent.prepareToLeaveProcess(Intent.java:8894)
W/System.err: at android.app.Instrumentation.execStartActivity(Instrumentation.java:1517)
W/System.err: at android.app.Activity.startActivityForResult(Activity.java:4224)
W/System.err: at android.support.v4.app.BaseFragmentActivityJB.startActivityForResult(BaseFragmentActivityJB.java:48)
W/System.err: at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:75)
W/System.err: at android.app.Activity.startActivityForResult(Activity.java:4183)
W/System.err: at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:871)
W/System.err: at com.kbeanie.multipicker.core.PickerManager.pickInternal(PickerManager.java:147)
W/System.err: at com.kbeanie.multipicker.core.ImagePickerImpl.takePictureWithCamera(ImagePickerImpl.java:145)
W/System.err: at com.kbeanie.multipicker.core.ImagePickerImpl.pick(ImagePickerImpl.java:118)
W/System.err: at com.kbeanie.multipicker.api.CameraImagePicker.pickImage(CameraImagePicker.java:74)
...
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 1
- Comments: 15 (11 by maintainers)
Commits related to this issue
- Issue #46 — committed to coomar2841/android-multipicker-library by coomar2841 8 years ago
- #46 fix — committed to livotov/android-multipicker-library by livotov 8 years ago
- Merge pull request #51 from livotov/dev #46, #52 fixes — committed to coomar2841/android-multipicker-library by coomar2841 8 years ago
I fixed that. The problem is you don’t create the final subfolder (“pictures” or “videos”, etc) in your PickerManager.getNewFileLocation method, so the file provider cannot find the final destination folder. Adding file.mkdirs(); solved the problem, just sent you a pull request with the fix.
Uploaded a beta build for testing it out…
compile 'com.kbeanie:multipicker:1.1.2-beta@aar'
More Info: https://code.google.com/p/android/issues/detail?id=203555
Thanks for the report. Will look at this issue.