You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2020/08/05 19:53:27 UTC

[GitHub] [cordova-plugin-camera] epetre opened a new issue #642: Unable to create bitmap!

epetre opened a new issue #642:
URL: https://github.com/apache/cordova-plugin-camera/issues/642


   # Bug Report
   Crashlytics is giving us "Unable to create bitmap!" error for some users who try to take a picture.
   
   ## Problem
   An error happens as the user uploads what seems to him as a valid picture and he is stuck on that page because we require a picture.
   
   ### What is expected to happen?
   Just a normal flow of taking a picture and getting it's URL.
   
   ### What does actually happen?
   An error occurs and the user is stuck there "Unable to create bitmap!"
   
   ## Information
   So I don't have more information than what Crashlytics gives me other than the fact that it happens 100% of the time on Android and the below code and environment details.
   
   ### Command or Code
   //Not sure exactly where in the plugin, but here is how we call it.
   ```
       let options = {
         quality : 100,
         destinationType: this.camera.DestinationType.DATA_URL,
         sourceType: sourcetype,
         encodingType: this.camera.EncodingType.JPEG, //0 JPEG
         saveToPhotoAlbum: false,
         correctOrientation: true,
         cameraDirection: 1,//front
         allowEdit: false
       }
   
       return new Promise((resolve, reject) => {
         this.camera.getPicture(options).then(base64 => {
      
         }
      }
   ```
   
   ### Environment, Platform, Device
   Android, no specific version stands out.
   
   ### Version information
   ```
   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.1.0, ios 5.1.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 5.0.0, (and 26 other plugins)
   ```
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [x] I searched for existing GitHub issues
   - [x] I updated all Cordova tooling to most recent version
   - [x] I included all the necessary information above
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [cordova-plugin-camera] furkankatman commented on issue #642: Unable to create bitmap!

Posted by GitBox <gi...@apache.org>.
furkankatman commented on issue #642:
URL: https://github.com/apache/cordova-plugin-camera/issues/642#issuecomment-808909341


   I am still seeing this issue. Any solution for this ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [cordova-plugin-camera] wongpeiyi commented on issue #642: Unable to create bitmap!

Posted by GitBox <gi...@apache.org>.
wongpeiyi commented on issue #642:
URL: https://github.com/apache/cordova-plugin-camera/issues/642#issuecomment-801880069


   Had this happen on a production user too
   
   ```
   Mozilla/5.0 (Linux; Android 9; INE-LX2 Build/HUAWEIINE-LX2; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/89.0.4389.90 Mobile Safari/537.36
   ```
   
   Not much other info. Hopefully this helps


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [cordova-plugin-camera] xuyonghua edited a comment on issue #642: Unable to create bitmap!

Posted by GitBox <gi...@apache.org>.
xuyonghua edited a comment on issue #642:
URL: https://github.com/apache/cordova-plugin-camera/issues/642#issuecomment-833184450


   The storage has changed after Android11, and the APP can only access its own private directory or public directory, and cannot access the private directory of other apps. You call the system’s built-in crop that does not belong to your app, and access to your app’s private directory is not allowed. Please add the following compatible code to the createCaptureFile method.
   `
   
   if (Build.VERSION.SDK_INT >= 30) {
          return new File(Environment.getExternalStoragePublicDirectory(DIRECTORY_PICTURES), fileName);
   }
   
   `


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [cordova-plugin-camera] PTRFRLL commented on issue #642: Unable to create bitmap!

Posted by GitBox <gi...@apache.org>.
PTRFRLL commented on issue #642:
URL: https://github.com/apache/cordova-plugin-camera/issues/642#issuecomment-690699922


   I have the same issue on Android 11 (API 30) only. Running on Android 10 (API 29), everything works as normal.
   
   If I try to load an image from the library (`sourceType: LIBRARY`) I get: `Unable to create bitmap!`
   If I try to take an image from the camera (`sourceType: CAMERA`) I get:  `Attempt to invoke virtual method 'boolean java.io.File.mkdirs()' on a null object reference`
   
   ### Environment, Platform, Device
   
   Android 11 - R (API 30)
   Using AndroidX setting in my cordova `config.xml`:  `<preference name="AndroidXEnabled" value="true" />`
   
   ### Version information
   ```
      Cordova Platforms : android 8.1.0
      Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 16 other plugins)
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [cordova-plugin-camera] fullmooooon edited a comment on issue #642: Unable to create bitmap!

Posted by GitBox <gi...@apache.org>.
fullmooooon edited a comment on issue #642:
URL: https://github.com/apache/cordova-plugin-camera/issues/642#issuecomment-1057788878


   The same mistake (error in JavaScript  onFail), different reasons and Solutions
   My app runs on an Android 10 AR device
   I annotate a line of code which been red highlight error in my android studio Logcat to solve it
   `//            this.cordova.getActivity().getContentResolver().delete(uri, null, null);`
   Maybe my device just doesn't allow cordova to delete cacah.
   
   A suggestion, try view Android studio logcat


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [cordova-plugin-camera] PTRFRLL edited a comment on issue #642: Unable to create bitmap!

Posted by GitBox <gi...@apache.org>.
PTRFRLL edited a comment on issue #642:
URL: https://github.com/apache/cordova-plugin-camera/issues/642#issuecomment-690699922


   I have the same issue on Android 11 (API 30) only. Running on Android 10 (API 29), everything works as normal.
   
   If I try to load an image from the library (`sourceType: PHOTOLIBRARY`) I get: `Unable to create bitmap!`
   If I try to take an image from the camera (`sourceType: CAMERA`) I get:  `Attempt to invoke virtual method 'boolean java.io.File.mkdirs()' on a null object reference` (Seems related to #658)
   
   ### Environment, Platform, Device
   
   Emulated Android 11 - R (API 30)
   Using AndroidX setting in my cordova `config.xml`:  `<preference name="AndroidXEnabled" value="true" />`
   
   ### Version information
   ```
      Cordova Platforms : android 8.1.0
      Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 16 other plugins)
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [cordova-plugin-camera] Xdabier commented on issue #642: Unable to create bitmap!

Posted by GitBox <gi...@apache.org>.
Xdabier commented on issue #642:
URL: https://github.com/apache/cordova-plugin-camera/issues/642#issuecomment-1031690356


   For anyone still facing this issue with ionic 3, or anyu version with this plugin, it only happens when you set the options to 
   ```
   allowEdit: true,
   targetWidth: <any value>,
   targetHeight: <any value>,
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [cordova-plugin-camera] PTRFRLL edited a comment on issue #642: Unable to create bitmap!

Posted by GitBox <gi...@apache.org>.
PTRFRLL edited a comment on issue #642:
URL: https://github.com/apache/cordova-plugin-camera/issues/642#issuecomment-690699922


   I have the same issue on Android 11 (API 30) only. Running on Android 10 (API 29), everything works as normal.
   
   If I try to load an image from the library (`sourceType: PHOTOLIBRARY`) I get: `Unable to create bitmap!`
   If I try to take an image from the camera (`sourceType: CAMERA`) I get:  `Attempt to invoke virtual method 'boolean java.io.File.mkdirs()' on a null object reference`
   
   ### Environment, Platform, Device
   
   Android 11 - R (API 30)
   Using AndroidX setting in my cordova `config.xml`:  `<preference name="AndroidXEnabled" value="true" />`
   
   ### Version information
   ```
      Cordova Platforms : android 8.1.0
      Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 16 other plugins)
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [cordova-plugin-camera] PieterVanPoyer commented on issue #642: Unable to create bitmap!

Posted by GitBox <gi...@apache.org>.
PieterVanPoyer commented on issue #642:
URL: https://github.com/apache/cordova-plugin-camera/issues/642#issuecomment-844425503


   @epetre is this issue still happening with the latest version?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [cordova-plugin-camera] shahdeep1989 commented on issue #642: Unable to create bitmap!

Posted by GitBox <gi...@apache.org>.
shahdeep1989 commented on issue #642:
URL: https://github.com/apache/cordova-plugin-camera/issues/642#issuecomment-863759337


   @PieterVanPoyer Yes I am still facing same issue with latest version.
   
   var options = {
         quality: 90,
         destinationType: Camera.DestinationType.DATA_URL,
         sourceType: 1,
         encodingType: 1,  // JPEG=0  PNG=1
         mediaType: Camera.MediaType.PICTURE,
         allowEdit: true,
         correctOrientation: true,
         targetWidth: 480,
         targetHeight: 480,
         cameraDirection: 1
       };


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [cordova-plugin-camera] nileshbandekar commented on issue #642: Unable to create bitmap!

Posted by GitBox <gi...@apache.org>.
nileshbandekar commented on issue #642:
URL: https://github.com/apache/cordova-plugin-camera/issues/642#issuecomment-949913186


   @xuyonghua Perfect solution , 
   Thank You...!!!!!!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [cordova-plugin-camera] fullmooooon commented on issue #642: Unable to create bitmap!

Posted by GitBox <gi...@apache.org>.
fullmooooon commented on issue #642:
URL: https://github.com/apache/cordova-plugin-camera/issues/642#issuecomment-1057788878


   The same mistake (error in JavaScript  onFail), different reasons and Solutions
   My app runs on an Android 10 AR device
   I annotate a line of code which been red highlight error in my android studio Logcat to solve it
   `//            this.cordova.getActivity().getContentResolver().delete(uri, null, null);`
   Maybe my device just doesn't allow cordova to delete cacah.
   
   For a suggestion, try view Android studio logcat


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [cordova-plugin-camera] xuyonghua commented on issue #642: Unable to create bitmap!

Posted by GitBox <gi...@apache.org>.
xuyonghua commented on issue #642:
URL: https://github.com/apache/cordova-plugin-camera/issues/642#issuecomment-833184450


   The storage has changed after Android11, and the APP can only access its own private directory or public directory, and cannot access the private directory of other apps. You call the system’s built-in crop that does not belong to your app, and access to your app’s private directory is not allowed. Please add the following compatible code to the createCaptureFile method.
   `
   if (Build.VERSION.SDK_INT >= 30) {
             return new File(Environment.getExternalStoragePublicDirectory(DIRECTORY_PICTURES), fileName);
           }
   `


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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