question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FileUriExposedException

See original GitHub issue

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)
...

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:15 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
livotovcommented, Sep 10, 2016

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.

1reaction
coomar2841commented, Aug 24, 2016

Uploaded a beta build for testing it out…

compile 'com.kbeanie:multipicker:1.1.2-beta@aar'

Read more comments on GitHub >

github_iconTop Results From Across the Web

FileUriExposedException - Android Developers
On this page; Summary. Public constructors; Inherited methods. Public constructors. FileUriExposedException. Android Developers.
Read more >
file:///storage/emulated/0/test.txt exposed beyond app through ...
But A file path String never hurt anybody, so it works without throwing FileUriExposedException. Tested on API levels 9 to 29! Successfully opens...
Read more >
What is android.os.FileUriExposedException and what you ...
This error occurs when you try to share a file:// Uri in an Intent broadcast to share data with other apps. Using file://...
Read more >
How To Handle "android.os.FileUriExposedException" In ...
Open Android Studio and select "Create new project". Name the project as per your wish and select your activity template. How To Handle...
Read more >
android.os.FileUriExposedException on Android Studio
File Uri Exposed Exception : android.os. fileUriExposedException use File Provider to soled the above exception.FileProvider is a special ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found