EiyuuZack commented on code in PR #1678: URL: https://github.com/apache/cordova-android/pull/1678#discussion_r1413735730
########## framework/build.gradle: ########## @@ -50,8 +50,8 @@ android { buildToolsVersion cordovaConfig.BUILD_TOOLS_VERSION compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 Review Comment: This approach is sensible, however it is not enough when factoring in Kotlin. If Kotlin is enabled, its compiler will target the toolchain JDK by default, which in this case is JDK 17 due to the AGP 8/Gradle 8 requirements. This will cause a conflict during build since Java and Kotlin are targeting different JDKs (8 and 17 respectively). In order to overcome this, the `jvmTarget` property (which controls the Kotlin compiler) must be set to to the same value as `targetCompatibility` (which controls de Java compiler). This is why, as per my comment above, the Gradle file generated in a pure Android project contains: ``` compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = '1.8' } ``` This ensures no compiler conflicts during build. In short, your new preference must set all these three properties to the same semantic value. Well, technically only `targetCompatibility` and `jvmTarget` since `sourceCompatibility` can be equal or lower to `targetCompatibility`, but I personally have never seen anyone do that. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org