tungdx / android-media-picker

A library for choose photos, videos from Android devices.
185 stars 57 forks source link

Android N FileUriExposedException: exposed beyond app through ClipData.Item.getUri() #11

Closed noamamiran closed 4 years ago

noamamiran commented 7 years ago

On Android N, When trying to capture image from camera the following ex raised: FileUriExposedException: exposed beyond app through ClipData.Item.getUri()

noamamiran commented 7 years ago

https://inthecheesefactory.com/blog/how-to-share-access-to-file-with-fileprovider-on-android-nougat/en

saeid-pm commented 6 years ago

try add this code before capture image :

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

BambangHeriSetiawan commented 6 years ago

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

that is work for me.

cristian9016 commented 6 years ago

this solution worked!! thanks.

Albatoul commented 5 years ago

You are genius

toantk238 commented 5 years ago

Oh, I thought I have solved this issue. Now this still happens on Android N ?

vanyasem commented 5 years ago

That's a dirty workaround and not a proper solution. Refer to https://stackoverflow.com/questions/48117511/exposed-beyond-app-through-clipdata-item-geturi for more details

PrasanthKumarKatta commented 5 years ago
     Caused by: java.lang.SecurityException: 
Permission Denial: opening provider android.support.v4.content.FileProvider from ProcessRecord{24ff435 15339:com.android.gallery3d/u0a44} (pid=15339, uid=10044) that is not exported from uid 10138
PrasanthKumarKatta commented 5 years ago

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

that is work for me.

 Caused by: java.lang.SecurityException: Permission Denial: opening provider android.support.v4.content.FileProvider from ProcessRecord{24ff435 15339:com.android.gallery3d/u0a44} (pid=15339, uid=10044) that is not exported from uid 10138

ava.lang.IllegalStateException: Binder has been finalized! at android.os.BinderProxy.transactNative(Native Method) at android.os.BinderProxy.transact(Binder.java:622)

abhisheksharma18021999 commented 4 years ago

@toantk238

aasinationskie commented 2 years ago

StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.setVmPolicy(builder.build()); thsi work but by using this the security policy will become week.