Execution failed for task ':capacitor-android:compileDebugJavaWithJavac'

[capacitor] > Could not resolve all files for configuration ‘:capacitor-android:androidJdkImage’. [capacitor] > Failed to transform core-for-syst

my original settings are gradle 8.5, AGP 8.2.0 and jDK 21.

now, i read in a git hub post that jdk 17 should be used. sure. i did just that but the same error persists. sure, i changed it to jdk 17 as well as the corresponding gradle versions but the same error persists.

thoughts about what could other possible issues be?

using ionic 7.2.0

are you sure you are using JDK 17?
did you set GRADLE_LOCAL_JAVA_HOME to use JDK 17?

hi julio. no. only java_home. i didnt see any in the posts that mentions that. and yes the java home pointa to the jdk 17.

i have another question, if i use android studio with jdk 21 and gradle 8, it deploys fine. is this because capacitor is built to support until jdk 17 only?

Android Studio by default uses the JDK included in Android Studio, which is JDK 17.
When you build from the command line then gradle will use whatever version is configured to use.
GRADLE_LOCAL_JAVA_HOME is a new variable introduced in gradle 8.2, but supposedly it should respect the JAVA_HOME if it’s already configured.

ok. then my case is odd. if i use android studio, it deploys fine with settings 8.5 gradle and jdk 21.

but if run in cli ionic cap run android, that error happens.

and i did try using jdk 17, with java home pointing to it and default gradle versions generated by ionic start.

So i followed with jdk 17 but had to change the gradle version to 7.3.0 and graddle wrapper 7.4 to make it work. not the version 8 that the ionic template provides

@julio-ionic where should i set GRADLE_LOCAL_JAVA_HOME in ionic? should it still be in .gradle/config.properties?

GRADLE_LOCAL_JAVA_HOME is a gradle thing, not an Ionic thing, not really sure where it should go, I didn’t set it anywhere and apps work fine with gradle 8.0 and 8.2.