[Camera Plugin] App crashes and restarts when taking and confirming a picture

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. The debugging is killed as soon as an image is captured and then once the image captured is confirmed it restarts the application.

I am using the plugin @capacitor/Camera version ^4.1.4.

minsdkversion: 22
compilesdkversion: 33
targetsdkversion: 33

Hi, I think the main issue is that Capacitor version 4.x does not fully support Android 13; it is only supposed to work up to Android 12.

Therefore, when we set compileSdkVersion and targetSdkVersion from 32 to 33 in a Capacitor 4 project, strange things will occur. I recommend that you keep compileSdkVersion and targetSdkVersion set to 32 for Capacitor 4.x project, in order to avoid unexpected behaviors.

To fully address issues on Android 13, I think the best approach will be upgrade to Capacitor version 5 (Capacitor 5.0 beta just released recently), which will have official Android 13 support!

I also found that there is a recent PR that fix the permissions issue for Android 13, which is released in @capacitor/camera version 5.0.0-beta.0

So, if you have some free time, you can try upgrading your project to Capacitor 5 beta, and then upgrading the capacitor plugins to ^5.0.0-beta.0 version.

Trying out the current Capacitor 5 beta version and providing feedback will help the Ionic Team to release the final version of Capacitor 5.0!

1 Like