Change default JDK version used by Capacitor in Android projects?


I have an Android project that is using Ionic Capacitor and I realised that the .gradle files that are autogenerated by Capacitor are setting as sourceCompatibility and targetCompatibility JavaVersion.VERSION_1_8 but the rest of the app is using JavaVersion.VERSION_11.

This difference is making Gradle to choose 1.8 when compiling the project.

Is there a way to configure Capacitor to use version 11. Ideally this change needs to prevent that if later “capacitor update android” is executed, the value is not reverted back to 1.8.


You can change it yourself if you’d like. It is potentially a breaking change which is why we aren’t changing it in minor versions of Capacitor. Capacitor 4 will ship with VERSION_11 instead of VERSION_1_8

Hi @thomasvidas when Capacitor 4 will be shipped?

No official date yet, but it will come out in Summer 2022

ok, thank you for the info.