How to update capacitor to use android project to SDK v30

I am not sure how to update my capacitor Android project to target SDK v30.
Every time I do rm -rf ./android && ionic capacitor copy android
and edit the build.gradle and variables.grade to set

compileSdkVersion = 30
targetSdkVersion = 30

uploading the apk fails on the play store with

Your app currently targets API level 29 and must target at least API level 30 to ensure it is built on the latest APIs optimized for security and performance. Change your app's target API level to at least 30.

I bet I only have to update capacitor somehow or run it with a flag, but just which one?

in Android Studio, open Project Structure and then set like this:


are you using capacitor v3 ?
If you are stil using capacitor 2, follow this tutorial for migrating to capacitor 3
migration to capacitor 3

1 Like

Thanks, I’ll check this. Still on Cap2 because of some compatibility issues. Need to check if upgrade to cap3 is easy for my dependencies.

Just changing it in the UI worked, I did not have to edit any other file after that. Changes were propagated there. Essentially it overrode the capacitor configuration.

I migrated to Capacitor 5 and all is well.