Skip to content
This repository has been archived by the owner on Mar 27, 2020. It is now read-only.

FileUriExposedException public class FileUriExposedException when android-targetSdkVersion from 24 #58

Open
dohoangn opened this issue May 8, 2017 · 3 comments

Comments

@dohoangn
Copy link

dohoangn commented May 8, 2017

App crash when android-targetSdkVersion equals or more than 24 in config.xml
<preference name="android-targetSdkVersion" value="24" />
Working fine if change to 23.

05-08 09:49:00.031 24924 24924 E AndroidRuntime: android.os.FileUriExposedException: file:///storage/emulated/0/invoice.pdf exposed beyond app through Intent.getData()
05-08 09:49:00.031 24924 24924 E AndroidRuntime: at android.os.StrictMode.onFileUriExposed(StrictMode.java:1796)
05-08 09:49:00.031 24924 24924 E AndroidRuntime: at android.net.Uri.checkFileUriExposed(Uri.java:2346)
05-08 09:49:00.031 24924 24924 E AndroidRuntime: at android.content.Intent.prepareToLeaveProcess(Intent.java:8981)
05-08 09:49:00.031 24924 24924 E AndroidRuntime: at android.content.Intent.prepareToLeaveProcess(Intent.java:8942)
05-08 09:49:00.031 24924 24924 E AndroidRuntime: at android.app.Instrumentation.execStartActivity(Instrumentation.java:1519)
05-08 09:49:00.031 24924 24924 E AndroidRuntime: at android.app.Activity.startActivityForResult(Activity.java:4229)
05-08 09:49:00.031 24924 24924 E AndroidRuntime: at org.apache.cordova.CordovaActivity.startActivityForResult(CordovaActivity.java:332)
05-08 09:49:00.031 24924 24924 E AndroidRuntime: at android.app.Activity.startActivityForResult(Activity.java:4187)
05-08 09:49:00.031 24924 24924 E AndroidRuntime: at android.app.Activity.startActivity(Activity.java:4526)
05-08 09:49:00.031 24924 24924 E AndroidRuntime: at android.app.Activity.startActivity(Activity.java:4494)
05-08 09:49:00.031 24924 24924 E AndroidRuntime: at org.apache.cordova.inappbrowser.InAppBrowser.openExternal(InAppBrowser.java:353)
05-08 09:49:00.031 24924 24924 E AndroidRuntime: at org.apache.cordova.inappbrowser.InAppBrowser$1.run(InAppBrowser.java:183)
05-08 09:49:00.031 24924 24924 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:751)
05-08 09:49:00.031 24924 24924 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:95)
05-08 09:49:00.031 24924 24924 E AndroidRuntime: at android.os.Looper.loop(Looper.java:154)
05-08 09:49:00.031 24924 24924 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6186)
05-08 09:49:00.031 24924 24924 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
05-08 09:49:00.031 24924 24924 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
05-08 09:49:00.031 24924 24924 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)

@prolog8
Copy link

prolog8 commented Jul 14, 2017

Yes, Give me five.

I also encountered this problem.

Both conditions: (Android >= 7) and (SDK >= 24)

but, if SDK >= 24 and Android < 7 Is still able to run.

Willow

@san0suke
Copy link

code:
"file:/storage/sdcard/Download/nf.pdf exposed beyond app through Intent.getData()"

@disusered
Copy link
Owner

disusered commented Jul 14, 2017

I have been away from Cordova development for some time. I have a few weeks free and will be updating my plugins in this timespan. I don't have an ETA but I set up my Android environment earlier, I'll keep you posted.

disusered/cordova-safe#18 (comment)

Same applies for this repo, I'll be at work this weekend on both plugins 🚀

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

No branches or pull requests

4 participants