cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joe Dalton (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CB-13432) plugin crashes with sdk bigger than 23 - implement FileProvider
Date Thu, 12 Oct 2017 07:21:00 GMT
Joe Dalton created CB-13432:
-------------------------------

             Summary: plugin crashes with sdk bigger than 23 - implement FileProvider
                 Key: CB-13432
                 URL: https://issues.apache.org/jira/browse/CB-13432
             Project: Apache Cordova
          Issue Type: Bug
          Components: cordova-plugin-media-capture
            Reporter: Joe Dalton


With android sdk higher than 23 I get the following error:

E/PluginManager: Uncaught exception from plugin
                                                                            android.os.FileUriExposedException:
file:///storage/emulated/0/Android/data/at.my.namespace/cache/.Pic.jpg exposed beyond app
through ClipData.Item.getUri()
                                                                                at android.os.StrictMode.onFileUriExposed(StrictMode.java:1799)
                                                                                at android.net.Uri.checkFileUriExposed(Uri.java:2346)
                                                                                at android.content.ClipData.prepareToLeaveProcess(ClipData.java:832)
                                                                                at android.content.Intent.prepareToLeaveProcess(Intent.java:9530)
                                                                                at android.content.Intent.prepareToLeaveProcess(Intent.java:9515)
                                                                                at android.app.Instrumentation.execStartActivity(Instrumentation.java:1525)
                                                                                at android.app.Activity.startActivityForResult(Activity.java:4403)
                                                                                at org.apache.cordova.CordovaActivity.startActivityForResult(CordovaActivity.java:342)
                                                                                at android.app.Activity.startActivityForResult(Activity.java:4362)
                                                                                at org.apache.cordova.CordovaInterfaceImpl.startActivityForResult(CordovaInterfaceImpl.java:66)
                                                                                at org.apache.cordova.camera.CameraLauncher.takePicture(CameraLauncher.java:294)
                                                                                at org.apache.cordova.camera.CameraLauncher.callTakePicture(CameraLauncher.java:265)
                                                                                at org.apache.cordova.camera.CameraLauncher.execute(CameraLauncher.java:174)
                                                                                at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98)
                                                                                at org.apache.cordova.PluginManager.exec(PluginManager.java:132)
                                                                                at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:57)
                                                                                at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
                                                                                at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native
Method)
                                                                                at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:7)
                                                                                at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                at android.os.Looper.loop(Looper.java:154)
                                                                                at android.os.HandlerThread.run(HandlerThread.java:61)

It looks like Uri.fromFile has to be replaced with FileProvider.getUriForFile

https://stackoverflow.com/questions/38200282/android-os-fileuriexposedexception-file-storage-emulated-0-test-txt-exposed

A quick fix is to limit the sdk to version 23 in config.xml:

    <platform name="android">
        <preference name="android-minSdkVersion" value="23" />
        <preference name="android-targetSdkVersion" value="23" />




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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


Mime
View raw message