App crashing on using camera - Capacitor on Android 12 / 13

Explanation of Problem:

App crashes and restarts when taking and confirming a picture on Android 12 and 13.
App crashes on clicking this button after taking picture

We are using Capacitor camera plugin. When capturing an image with the Camera plugin it crashes everytime I take a picture and the app restarts.

This only happens on Android 12 and 13. It works perfectly fine on Android less than 12. I can’t find any exceptions when debugging on a mobile device because debugging is killed as soon as an image is captured and then once the image captured is confirmed it restarts the application.

Capacitor ver: 4.2.0
minsdkversion: 22
compilesdkversion: 33
targetsdkversion: 33

Tried Solutions
We tried different open source cordova plugins but nothing worked as all of them have not been updated since 2021. Please help us resolve this issue or should we consider changing our dev platform ?

Its 3rd day of this problem. We are spending man hours like anything on this bug.

Thank you for your time in advance.

Is capacitor community this dead ??? no reply since 5 days

2 Likes

Hi @ersaurabh101, I think the main issue is that Capacitor 4.x does not work nicely when we set compileSdkVersion and targetSdkVersion from 32 to 33.

You can check out this for more details:

1 Like

Having same issue, updated to capacitor camera 5.0.2 still this issue is not resolved, I have tested it on many devices but not able to figure out why its crashing the app. this issue is not happens to every device it is for some specific device i thought it would be android version 11/12 issue but camera is working with other device having same android version. have tried cordova plugin as well but didnt worked, have disabled photo editing, used Data.URI, followed each and every instruction from capacitor documentation but nothing worked for me.
if any one have solution please let us know soon as possible thank you

You have to use Capacitor 5 for API 33

Has anyone got a fix for this yet? I updated to capacitor camera 5.0.7 and still users report problems accepting the picture once it has been taken. The app crashes and restarts with no debugging errors. This is effecting my business as it is a picture taking application. @mohammeddanish247 did you solve it?

I haven’t got a fix yet, but I managed to resolve the issue by utilizing the Cordova Filesystem plugin. Here’s how my approach functions: By using Capacitor Camera i am getting Data.Uri and after getting uri I am saving/writing it to the Device’s storage and then reading it as it’s required using Filesystem plugin.

@ersaurabh101 @mohammeddanish247 I have written up a bug report with a small project to reproduce the issue. Please take a look at my report and give it a thumbs up in GitHub if it matches what you are experiencing.