Hello, I'm new to this slack channel and looking f...
# community-support
c
Hello, I'm new to this slack channel and looking for help in getting things configured I am trying to use an ionic capacitor app and running into issues with JDK versions in gradle. Gradle seems to be convinced that I need JDK 21 and its not there (even though I have JDK 21 installed) but I believe my project needs JDK17. VS Code has never been able to launch the android app. I've had to build, sync, and then go to Android studio to open it. No matter what I do, I can't get android/app/capacitor.build.gradle to show any version other than 21
* What went wrong:
Execution failed for task ':capacitor-android:compileReleaseJavaWithJavac'.
> error: invalid source release: 21
Not sure If I'm posting in the right place or asking the right question, but if anyone could assist it would be greatly appreciated!
c
The best way to go about this is to use toolchains, that way whatever jdk your ide/tool wants to invoke gradle with is independent of the version used to compile/test your app.
👆 1
v
What Clayton said. Besides that, the error is telling you, that you either configured a Java <21 toolchain or have no toolchain configured but run Gradle with Java <21, but in your build script use
sourceCompatibility = 21
which generally is a bad idea anyway.
c
got it. Thanks! I'll try to explore using toolchains