Shopify / flash-list

A better list for React Native
https://shopify.github.io/flash-list/
MIT License
5.38k stars 276 forks source link

* What went wrong: Execution failed for task ':shopify_flash-list:compileReleaseKotlin'. > 'compileReleaseJavaWithJavac' task (current target is 11) and 'compileReleaseKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version. Consider using JVM toolchain: https://kotl.in/gradle/jvm/toolchain #933

Open sonuwise opened 11 months ago

sonuwise commented 11 months ago

If add the kotlin version to build.gradle then react native gesture handler packages throws error. Kindly assist me

L0rdCr1s commented 11 months ago

in your android>build.gradle file add

buildscript {
     ext {
        ....
        kotlinVersion = "1.8.10"
       ...

in your android>app>build.gradle add

android {
    .....
    composeOptions {
          kotlinCompilerExtensionVersion = "1.4.4"
    }
    .....

I hope this helps

sonuwise commented 11 months ago

@L0rdCr1s

in your android>build.gradle file add

buildscript {
     ext {
        ....
        kotlinVersion = "1.8.10"
       ...

in your android>app>build.gradle add

android {
    .....
    composeOptions {
          kotlinCompilerExtensionVersion = "1.4.4"
    }
    .....

I hope this helps

in your android>build.gradle file add

buildscript {
     ext {
        ....
        kotlinVersion = "1.8.10"
       ...

in your android>app>build.gradle add

android {
    .....
    composeOptions {
          kotlinCompilerExtensionVersion = "1.4.4"
    }
    .....

I hope this helps

I getting react native gesture handle issue if use this ``Execution failed for task ':react-native-gesture-handler:compileDebugKotlin'.

'compileDebugJavaWithJavac' task (current target is 11) and 'compileDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version. Consider using JVM toolchain: https://kotl.in/gradle/jvm/toolchain``

Im using react-native-gesture-handler-version:2.13.3 and if fix this then react-native-safe-area-context pops up with the same above error

itajenglish commented 11 months ago

+1

Moatezz commented 11 months ago

+2 I had to uninstall the package and comment on every Flashlist component and they're a lot in my app just to get it to show me the login screen can I expect a swift fix for this bug or should I look for alts?

Neiso commented 2 weeks ago

I fixed this by forcing flash-list to use Java 11.

~ java --version
openjdk 11.0.15 2022-04-19 LTS
OpenJDK Runtime Environment Zulu11.56+19-CA (build 11.0.15+10-LTS)
OpenJDK 64-Bit Server VM Zulu11.56+19-CA (build 11.0.15+10-LTS, mixed mode)

Here is a patch-package:

diff --git a/node_modules/@shopify/flash-list/android/build.gradle b/node_modules/@shopify/flash-list/android/build.gradle
index 0585d2a..f75cb04 100644
--- a/node_modules/@shopify/flash-list/android/build.gradle
+++ b/node_modules/@shopify/flash-list/android/build.gradle
@@ -44,8 +44,12 @@ android {
     }

     compileOptions {
-        sourceCompatibility JavaVersion.VERSION_1_8
-        targetCompatibility JavaVersion.VERSION_1_8
+      sourceCompatibility = JavaVersion.VERSION_11
+      targetCompatibility = JavaVersion.VERSION_11
+    }
+
+    kotlinOptions {
+      jvmTarget = JavaVersion.VERSION_11.toString()
     }

     sourceSets {

Dunno if this is right or wrong but project compiles and all my flashlist are working.

I'd love to know from expert what are the risks of forcing the usage of Java 11 though.