I am not sure beforehand I would also try updating the gradle versions in android/build.gradle, android/app/build.gradle and android/gradle/wrapper/gradle-wrapper.properties.
If that doesn't work I would think that maybe it's time to migrate from cordova to capacitor 5 which currently has targetsdkversion 34.