cordova-plugin-camera: Cordova-plugin-camera crashes app on android devices
Issue Type
- Bug Report
- Feature Request
- Support Question
Description
The app crashes when the photo is captured. Error checked on Android 9 and 10, on IOS works well
Information
Command or Code
navigator.camera.getPicture(this.onSuccess, this.onFail, {
quality: 50,
allowEdit: false,
correctOrientation: true,
allowEdit: true,
destinationType: destinationType.DATA_URL
});
Environment, Platform, Device
Version information
Cordova Packages:
cli: 10.0.0
common: 4.0.2
create: 3.0.0
lib: 10.0.0
common: 4.0.2
fetch: 3.0.0
serve: 4.0.0
Project Installed Platforms:
android: 8.1.0
ios: 6.1.1
Project Installed Plugins:
cordova-plugin-actionsheet: 2.3.3
cordova-plugin-add-swift-support: 2.0.2
cordova-plugin-biometric: 0.0.3
cordova-plugin-camera: 4.0.3
cordova-plugin-dialogs: 2.0.2
cordova-plugin-file-transfer: 1.7.1
cordova-plugin-file: 6.0.2
cordova-plugin-fingerprint-aio: 3.0.1
cordova-plugin-geolocation: 4.0.2
cordova-plugin-keyboard: 1.2.0
cordova-plugin-network-information: 2.0.2
cordova-plugin-whitelist: 1.3.4
Checklist
- I searched for already existing GitHub issues about this
- I updated all Cordova tooling to their most recent version
- I included all the necessary information above
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 2
- Comments: 28 (11 by maintainers)
@charlieshin @lanadedstudio can you both try with the latest camera plugin release?
I have just released a few hours ago version 5.0.0.
You should be able to use the latest just by removing and readding.
Sorry, I should also note that the latest release also required Cordova-Android platform
>= 9.0.0
.Yes, the problem persists
Cordova Version: 10.00 Cordova Plugin Camera Version: 5.0.1
I recently tested the error on smartphone models:
Smartphone Model: Moto G7 Play OS Version: Android 10
Smartphone Model: Asus_X00TDB OS Version: Android 9
When I installed an external camera app (not the android camera) it worked normally.
Hi, is there any update on this issue ? I’m using the plugin v5.0.1 and the app still crashes after taking a photo with the back camera
Device: Motorola E7 with 4 GB RAM Android: 10
My solution was install Open Camera and use this app to take photos from my Cordova App.
Before Open Camera I was using the Motorola’s Camera App that abruptly closes my app after I confirm a taken photo.
I confirm that upgrading to 6.0.0 along side updgrading to cordova 10 and cordova-android 10 works in our project.
Nb : If you upgrade cordova from 8 to 10, don’t forget to add cordova-plugin-androidx-adapter plugin in your project, and verify gradle dependencies, in our case com.google.gms:google-services needs to be updated to 4.3.8.
@lanadedstudio is this issue still occuring with the latest Cordova and Cordova plugins versions?
This plugin likely doesn’t handle API 29/30 changes to external storage. There should be potential two workarounds for the time being:
requestLegacyExternalStorage
flag to theAndroidManifest.xml
fileAdding this to your
config.xml
should work:Note:
requestLegacyExternalStorage
is ignored on API 30.After updating the plugin, the photos with the front camera are working, but the photos with the back camera still close the application. I removed the option to allow image editing. I also tested it with another camera app and it worked.