You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Vitor Oliveira (JIRA)" <ji...@apache.org> on 2018/08/14 10:42:00 UTC

[jira] [Created] (CB-14267) [ANDROID] Application crash with FileUriExposedException trying launch intent with file URI

Vitor Oliveira created CB-14267:
-----------------------------------

             Summary: [ANDROID] Application crash with FileUriExposedException trying launch intent with file URI
                 Key: CB-14267
                 URL: https://issues.apache.org/jira/browse/CB-14267
             Project: Apache Cordova
          Issue Type: Bug
          Components: cordova-android
    Affects Versions: cordova-android-7.0.0
            Reporter: Vitor Oliveira


Android application crashes when there are an error and Cordova handle with it. 

Error:  
{code:java}
android.os.FileUriExposedException: file:///android_asset/www/error.html exposed beyond app through Intent.getData(){code}
 

Steps to reproduce: 
 # Define preference: ErrorUrl on config.xml 
 # Define on allow-intent:

{noformat}
<allow-intent href="file://*" /> or <allow-intent href="*" />{noformat}

 # Force an error, like an invalid link, to show the error 

 

The application will crash because of the changes introduced on Android N:
{quote}{{Passing }}{{[file://|file:///]}}{{ URIs outside the package domain may leave the receiver with an unaccessible path. Therefore, attempts to pass a }}{{[file://|file:///]}}{{ URI trigger a }}{{FileUriExposedException}}{{. The recommended way to share the content of a private file is using the }}{{[FileProvider|https://developer.android.com/reference/android/support/v4/content/FileProvider.html]}}{{.}}
{quote}
 

Full crash log:
{noformat}
08-14 10:12:23.898 8399-8399/com.outsystems.rd.intentprovider E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.outsystems.rd.intentprovider, PID: 8399
android.os.FileUriExposedException: file:///android_asset/www/error.html exposed beyond app through Intent.getData()
at android.os.StrictMode.onFileUriExposed(StrictMode.java:1958)
at android.net.Uri.checkFileUriExposed(Uri.java:2348)
at android.content.Intent.prepareToLeaveProcess(Intent.java:9766)
at android.content.Intent.prepareToLeaveProcess(Intent.java:9720)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1609)
at android.app.Activity.startActivityForResult(Activity.java:4472)
at org.apache.cordova.CordovaActivity.startActivityForResult(CordovaActivity.java:343)
at android.app.Activity.startActivityForResult(Activity.java:4430)
at android.app.Activity.startActivity(Activity.java:4791)
at android.app.Activity.startActivity(Activity.java:4759)
at org.apache.cordova.CordovaWebViewImpl.showWebPage(CordovaWebViewImpl.java:239)
at org.apache.cordova.CordovaActivity$2.run(CordovaActivity.java:379)
at android.app.Activity.runOnUiThread(Activity.java:6152)
at org.apache.cordova.CordovaActivity.onReceivedError(CordovaActivity.java:377)
at org.apache.cordova.CordovaActivity.onMessage(CordovaActivity.java:465)
at org.apache.cordova.CordovaActivity$1.onMessage(CordovaActivity.java:214)
at org.apache.cordova.PluginManager.postMessage(PluginManager.java:318)
at org.apache.cordova.CordovaWebViewImpl$EngineClient.onReceivedError(CordovaWebViewImpl.java:518)
at org.apache.cordova.engine.SystemWebViewClient.onReceivedError(SystemWebViewClient.java:209)
at android.webkit.WebViewClient.onReceivedError(WebViewClient.java:267)
at com.android.webview.chromium.WebViewContentsClientAdapter.onReceivedError2(WebViewContentsClientAdapter.java:627)
at org.chromium.android_webview.AwContentsClientCallbackHelper$MyHandler.handleMessage(AwContentsClientCallbackHelper.java:7357)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
{noformat}
 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org