EvanBacon / expo-quick-actions

Add home screen quick actions / shortcuts to your React Native app
MIT License
281 stars 7 forks source link

Build failing due to mismatched kotlinOptions JavaVersion [SDK50/Java17] #9

Closed gorbypark closed 7 months ago

gorbypark commented 7 months ago

After upgrading a project from SDK49 to SDK50, as well as updating from Java 11 to Java 17 (as required by react-native 0.73), my project stopped building (npx expo prebuild --clear; yarn android) with an error about mismatched kotlinOptions JavaVersion in this package. I'm not an expert on the Android build system by any means, but I was able to open up node_modules/expo-quick-actions/android/build.gradle and set kotlinOptions to jvmTarget = JavaVersion.VERSION_17.majorVersion and everything started working.

I could create a PR for this easily, but I think this would probably break for anyone still using SDK49/Java11, so I'm unsure of how to handle that.

This was the error

'compileDebugJavaWithJavac' task (current target is 17) and 'compileDebugKotlin' task (current target is 11) jvm target compatibility should be set to the same Java version

Here's a patch-package I created if anyone comes across the same issue, expo-quick-actions+0.2.8.patch

diff --git a/node_modules/expo-quick-actions/android/build.gradle b/node_modules/expo-quick-actions/android/build.gradle
index b30da32..c83b988 100644
--- a/node_modules/expo-quick-actions/android/build.gradle
+++ b/node_modules/expo-quick-actions/android/build.gradle
@@ -59,7 +59,7 @@ android {
   }

   kotlinOptions {
-    jvmTarget = JavaVersion.VERSION_11.majorVersion
+    jvmTarget = JavaVersion.VERSION_17.majorVersion
   }

   namespace "expo.modules.quickactions"
gorbypark commented 7 months ago

Turns out this is a known thing, https://github.com/expo/fyi/blob/main/expo-modules-gradle8-migration.md#error-task-current-target-is-17-and-compilereleasekotlin-task-current-target-is-11-jvm-target-compatibility-should-be-set-to-the-same-java-version

I created a PR that should fix the issue. https://github.com/EvanBacon/expo-quick-actions/pull/10

EvanBacon commented 7 months ago

Fixed in 1.0.0