Does Capacitor support Android 12?

Can we target Android API Version 31 with Capacitor?

I believe so. The documentation says “API 21 or greater” (reference).

This post someone got it working - Ionic 6 Android SDK Level 31 Not Working.

Yes. You can bump the build tools to use API Version 31 in your Capacitor project and it will (probably) work. Capacitor 4 is releasing before the Google Play deadline will target API 32

2 Likes

Capacitor 3 targets SDK 31.

Does that mean Capacitor 3 apps don’t work on Android 12?
No, they work in a sort of “compatibility mode” on Android versions greater than the SDK the app targets (Android 12 and newer).

Does Capacitor 3 supports to target SDK 31 or newer?
Capacitor allows to configure the targetSDK by updating the targetSdkVersion variable in the variables.gradle file, but if you do that the “compatibility mode” will be disabled on the Android version that matches your targetSdkVersion (31) and some things will break in Android 12 and newer devices, in example you’ll have to add an exported attribute to your App’s activities and push, local-notifications and share plugins will break.

So my recommendation is to keep using targetSdkVersion 30 until Capacitor 4 is released with SDK 31 and 32 fully supported, as Thomas said that would be before the Google Play deadline.

3 Likes