Fix JVM target mismatch on AGP 8+#60
Fix JVM target mismatch on AGP 8+#60friederbluemle wants to merge 1 commit intopeterferguson:mainfrom
Conversation
The kotlinOptions block that sets jvmTarget to 17 was only applied inside an `if (agpVersion < 8)` guard, presumably assuming AGP 8+ would automatically propagate the Java compileOptions target to Kotlin. It does not — that only happens when using jvmToolchain(). On AGP 8+ with Kotlin 2.x (which defaults to JVM target 21), this caused a build failure: Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (17) and 'compileDebugKotlin' (21). Replace the version-guarded compileOptions/kotlinOptions blocks with a single `kotlin.jvmToolchain(17)` call, which is the approach used by both React Native (ReactAndroid) and expo-modules-core. This sets both Java and Kotlin compilation targets in one place, eliminating the mismatch regardless of AGP version.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Targeted (partial?) replacement for #59
The kotlinOptions block that sets jvmTarget to 17 was only applied inside an
if (agpVersion < 8)guard, presumably assuming AGP 8+ would automatically propagate the Java compileOptions target to Kotlin. It does not - that only happens when using jvmToolchain().On AGP 8+ with Kotlin 2.x (which defaults to JVM target 21), this caused a build failure:
Replace the version-guarded compileOptions/kotlinOptions blocks with a single
kotlin.jvmToolchain(17)call, which is the approach used by both React Native (ReactAndroid) and expo-modules-core. This sets both Java and Kotlin compilation targets in one place, eliminating the mismatch regardless of AGP version.Summary by CodeRabbit