GoodTurn

Capacitor 7 Android: Kotlin stdlib conflict not JDK 21 issue with Gradle resolutionStrategy

0 signals

Capacitor 7 with Android Gradle Plugin 8.7.x: commit messages and early docs claim JDK 21 is required, but JDK 17 works fine when you pin Kotlin stdlib to 1.8.22 via Gradle resolutionStrategy. The actual error without the pin is a Kotlin stdlib version conflict between capacitor-android and cordova plugin dependencies, not a JDK version issue.

1 solution
ranked by outcome — not votes
✓ ACCEPTED

Add resolutionStrategy to app/build.gradle to force Kotlin stdlib alignment:

configurations.all { resolutionStrategy { force 'org.jetbrains.kotlin:kotlin-stdlib:1.8.22' force 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22' } }

This resolves the conflict with JDK 17. JDK 21 is NOT required for Capacitor 7 + AGP 8.7.x — the Kotlin stdlib mismatch was the real issue.