Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception android.os.FileUriExposedException: file:///storage/emulated/0/Android/data/com.xxx.xxx/cache/i_prefix_234 exposed beyond app through ClipData.Item.getUri() #39

Closed
wangdan0527 opened this issue Feb 1, 2018 · 6 comments
Labels

Comments

@wangdan0527
Copy link

Getting this issue when calling ImagePicker.pickImage.

@wangdan0527
Copy link
Author

wangdan0527 commented Feb 1, 2018

Exception android.os.FileUriExposedException: file:///storage/emulated/0/Android/data/com.xxx.xxx/cache/i_prefix_234 exposed beyond app through ClipData.Item.getUri()
android.os.StrictMode.onFileUriExposed (StrictMode.java:1960)
android.net.Uri.checkFileUriExposed (Uri.java:2348)
android.content.ClipData.prepareToLeaveProcess (ClipData.java:942)
android.content.Intent.prepareToLeaveProcess (Intent.java:9850)
android.content.Intent.prepareToLeaveProcess (Intent.java:9856)
android.content.Intent.prepareToLeaveProcess (Intent.java:9835)
android.app.Instrumentation.execStartActivity (Instrumentation.java:1610)
android.app.Activity.startActivityForResult (Activity.java:4487)
android.support.v4.app.BaseFragmentActivityApi16.startActivityForResult (BaseFragmentActivityApi16.java:54)
android.support.v4.app.FragmentActivity.startActivityForResult (FragmentActivity.java:65)
android.support.v4.app.ActivityCompat.startActivityForResult (ActivityCompat.java:152)
android.support.v4.app.FragmentActivity.startActivityFromFragment (FragmentActivity.java:789)
android.support.v4.app.FragmentActivity$HostCallbacks.onStartActivityFromFragment (FragmentActivity.java:898)
android.support.v4.app.Fragment.startActivityForResult (Fragment.java:1018)
android.support.v4.app.Fragment.startActivityForResult (Fragment.java:1007)
com.mvc.imagepicker.ImagePicker.startChooser (ImagePicker.java:184)
com.mvc.imagepicker.ImagePicker.pickImage (ImagePicker.java:164)
com.mvc.imagepicker.ImagePicker.pickImage (ImagePicker.java:148)
com.xxx.xxx.fragment.ProfileFragment.onClick (ProfileFragment.java:448)
android.view.View.performClick (View.java:6294)
android.view.View$PerformClick.run (View.java:24770)
android.os.Handler.handleCallback (Handler.java:790)
android.os.Handler.dispatchMessage (Handler.java:99)
android.os.Looper.loop (Looper.java:164)
android.app.ActivityThread.main (ActivityThread.java:6494)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:438)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:807)

@ranjeetDT
Copy link
Contributor

Yes, This issue will come if TargetSDKVersion > 24 and you run this code on devices having Android N. This needs to be fixed.

Mariovc added a commit that referenced this issue Feb 8, 2018
@alexpwf
Copy link

alexpwf commented Feb 11, 2018

is it possible to change the tag to update the library with jitPack?

@Mariovc
Copy link
Owner

Mariovc commented Feb 11, 2018

Yes sure, sorry. Now done!

@Mariovc Mariovc closed this as completed Feb 11, 2018
@Mariovc Mariovc added the bug label Feb 11, 2018
@Mariovc
Copy link
Owner

Mariovc commented Feb 13, 2018

There was a mistake in 1.2.1, try it now with 1.2.2, please

@imattaullah
Copy link

Just paste the below code in activity onCreate()

StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.setVmPolicy(builder.build());

It will ignore URI exposure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants