text: Q:
  
  Cordova application crashes when trying access the Camera
  
  I have a Cordova application (running on Android) that I have implemented the Cordova Camera plugin, I have a simple 'click' event that calls the following code which then pops up the message :
  "Allow MyHQAPP to access photos, media and files on your device?"
  I click 'Allow' and the app immediately closes?? I have checked the ADB error log and can see the following errors below
  Can anyone suggest what the issue is - note I am using the ngCordova plugin for the Camera functionality
  http://ngcordova.com/docs/plugins/camera/
  08-07 11:33:19.712 14954 15032 E PluginManager: Uncaught exception from plugin
  08-07 11:33:19.712 14954 15032 E PluginManager: android.os.FileUriExposedException: file:///storage/emulated/0/Android/data/com.mytechnologies.myapp_2017/cache/.Pic.jpg exposed beyond app through ClipData.Item.getUri()
  08-07 11:33:19.712 14954 15032 E PluginManager:         at android.os.StrictMode.onFileUriExposed(StrictMode.java:1799)
  08-07 11:33:19.712 14954 15032 E PluginManager:         at android.net.Uri.checkFileUriExposed(Uri.java:2346)
  08-07 11:33:19.712 14954 15032 E PluginManager:         at android.content.ClipData.prepareToLeaveProcess(ClipData.java:845)
  08-07 11:33:19.712 14954 15032 E PluginManager:         at android.content.Intent.prepareToLeaveProcess(Intent.java:8941)
  08-07 11:33:19.712 14954 15032 E PluginManager:         at android.content.Intent.prepareToLeaveProcess(Intent.java:8926)
  08-07 11:33:19.712 14954 15032 E PluginManager:         at android.app.Instrumentation.execStartActivity(Instrumentation.java:1690)
  08-07 11:33:19.712 14954 15032 E PluginManager:         at android.app.Activity.startActivityForResult(Activity.java:4291)
  08-07 11:33:19.712 14954 15032 E PluginManager:         at org.apache.cordova.CordovaActivity.startActivityForResult(CordovaActivity.java:342)
  08-07 11:33:19.712 14954 15032 E PluginManager:         at android.app.Activity.startActivityForResult(Activity.java:4249)
  08-07 11:33:19.712 14954 15032 E PluginManager:         at org.apache.cordova.CordovaInterfaceImpl.startActivityForResult(CordovaInterfaceImpl.java:66)
  08-07 11:33:19.712 14954 15032 E PluginManager:         at org.apache.cordova.camera.CameraLauncher.takePicture(CameraLauncher.java:259)
  08-07 11:33:19.712 14954 15032 E PluginManager:         at org.apache.cordova.camera.CameraLauncher.callTakePicture(CameraLauncher.java:233)
  08-07 11:33:19.712 14954 15032 E PluginManager:         at org.apache.cordova.camera.CameraLauncher.execute(CameraLauncher.java:168)
  08-07 11:33:19.712 14954 15032 E PluginManager:         at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98) 
  08-07 11:33:19.712 14954 15032 E PluginManager:         at org.apache.cordova.PluginManager.exec(PluginManager.java:132)
  08-07 11:33:19.712 14954 15032 E PluginManager:         at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:57)
  08-07 11:33:19.712 14954 15032 E PluginManager:         at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
  08-07 11:33:19.712 14954 15032 E PluginManager:         at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
  08-07 11:33:19.712 14954 15032 E PluginManager:         at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:7)
  08-07 11:33:19.712 14954 15032 E PluginManager:         at android.os.Handler.dispatchMessage(Handler.java:102)
  08-07 11:33:19.712 14954 15032 E PluginManager:         at android.os.Looper.loop(Looper.java:154)
  08-07 11:33:19.712 14954 15032 E PluginManager:         at android.os.HandlerThread.run(HandlerThread.java:61)
  08-07 11:33:21.836 13427 13427 E SimcardDataModel: provide unsupported slot id 0
  
  Within my js controller
  $scope.uploadFromCamera = function () {
      console.log('Upload from Camera');
  
      var options = {
          quality: 75,
          destinationType: Camera.DestinationType.DATA_URL,
          sourceType: Camera.PictureSourceType.CAMERA,
          allowEdit: true,
          encodingType: Camera.EncodingType.JPEG,
          targetWidth: 300,
          targetHeight: 300,
          popoverOptions: CameraPopoverOptions,
          saveToPhotoAlbum: false
      };
  
      $cordovaCamera.getPicture(options).then(function (imageData) {
          $scope.imgURI = "data:image/jpeg;base64," + imageData;
          console.log($scope.imgURI);
          console.log($scope);
      }, function (err) {
          // An error occured. Show a message to the user
      });
  }
  
  // Cordova info
  Node version: v6.10.3
  Cordova version: 6.0.0
  Config.xml file:
  <?xml version='1.0' encoding='utf-8'?>
  <widget id="com.mytechnologies.fakename_2017" versionCode='20002' version="2.0.2" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>MyAPP</name>
    <description>
      A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <author email="dev@cordova.apache.org" href="http://cordova.io">
      Apache Cordova Team
    </author>
    <content src="index.html" />
    <plugin name="cordova-plugin-whitelist" spec="1" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <platform name="android">
      <allow-intent href="market:*" />
    </platform>
    <platform name="ios">
      <allow-intent href="itms:*" />
      <allow-intent href="itms-apps:*" />
    </platform>
    <engine name="android" spec="~5.2.2" />
    <icon src="res/icon.png" />
  </widget>
  
  Plugins:
  cordova-plugin-camera,cordova-plugin-compat,cordova-plugin-whitelist
  cordova-plugin-camera 2.1.1 "Camera"
  cordova-plugin-whitelist 1.3.0 "Whitelist"
  
  A:
  
  try to change the version of cordova-plugin-camera to 2.4.1 
  
  