livekit / client-sdk-react-native-expo-plugin

Apache License 2.0
6 stars 4 forks source link

React Native Expo 51.0.4 Always failing with error - Inconsistent JVM-target compatibility detected for tasks #1

Open neocafe opened 5 months ago

neocafe commented 5 months ago

Task :livekit-react-native-expo-plugin:compileDebugKotlin FAILED

FAILURE: Build failed with an exception.

BioJorge commented 4 months ago

having the same problem. Have no idea how to fix, please help.

dmitryame commented 4 months ago

same here for me, please help!!!

dmitryame commented 4 months ago

I solved my problem, one of my dependencies was out of date, I was able to figure it out from the error message in the build log. Once I updated the npm dependency to the latest version -- everything builds now.

neocafe commented 4 months ago

@dmitryame Hi can you please let us know which dependency you changed

erenkulaksiz commented 4 months ago

same here.

dmitryame commented 4 months ago

It's hard to say for me, my logs are gone now, and I have updated so many dependencies in that PR. It's going to be specific for every case. Can you share more detailed log in this thread to help to understand your specific case?

erenkulaksiz commented 3 months ago

Our package.json:

"@livekit/react-native": "^2.3.1",
"@livekit/react-native-expo-plugin": "^1.0.0",
"@livekit/react-native-webrtc": "^125.0.0",

When i try to build the app:

      │ > Task :livekit-react-native-expo-plugin:compileDebugKotlin FAILED
      │
      │ FAILURE: Build failed with an exception.
      │
      │ * What went wrong:
      │ Execution failed for task ':livekit-react-native-expo-plugin:compileDebugKotlin'.
      │ > Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac'
      │ (17) and 'compileDebugKotlin' (20).
      │
      │   Consider using JVM Toolchain: https://kotl.in/gradle/jvm/toolchain
      │   Learn more about JVM-target validation: https://kotl.in/gradle/jvm/target-validation
      │
      │ * Try:
      │ > Run with --stacktrace option to get the stack trace.
      │ > Run with --info or --debug option to get more log output.
      │ > Run with --scan to get full insights.
      │ > Get more help at https://help.gradle.org.
      │
      │ Deprecated Gradle features were used in this build, making it incompatible with Gradle
      │ 9.0.
      │
      │ You can use '--warning-mode all' to show the individual deprecation warnings and determ
      │ ine if they come from your own scripts or plugins.
      │
      │ For more on this, please refer to https://docs.gradle.org/8.6/userguide/command_line_in
      │ terface.html#sec:command_line_warnings in the Gradle documentation.
      │
      │ BUİLD FAILED in 18s
      │ 602 actionable tasks: 124 executed, 466 from cache, 12 up-to-date
erenkulaksiz commented 3 months ago

I've solved the issue by temporarily removing this package and adding this code to ./plugins/withLiveKit.js and adding it to app.json as a plugin.


const { withAndroidManifest, AndroidConfig } = require('expo/config-plugins');

const withLiveKit = (config, options) => {
  if (options) {
    let androidOptions = options.android;
    if (androidOptions) {
      let audioType = androidOptions.audioType;
      if (audioType) {
        config = withAndroidManifest(config, (config) => {
          const mainApplication = AndroidConfig.Manifest.getMainApplicationOrThrow(
            config.modResults
          );

          AndroidConfig.Manifest.addMetaDataItemToMainApplication(
            mainApplication,
            'io.livekit.reactnative.expo.ANDROID_AUDIO_TYPE',
            audioType
          );
          return config;
        });
      }
    }
  }

  return config;
};

module.exports = withLiveKit;
Cheizr commented 2 months ago

Fresh installation.

npx expo run:android

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-can-draw-overlays:kaptGenerateStubsDebugKotlin'.
> Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (17) and 'kaptGenerateStubsDebugKotlin' (1.8).
Jonatthu commented 1 month ago

This is happening to me too

boussaidev commented 1 month ago

Fix for Java Version Compatibility Issue

I followed the steps below, and the issue is now fixed:

  1. Download JDK 17:
    Choose one of the following JDK 17 packages based on your system architecture:

    For macOS: Product/File Description File Size Download
    ARM64 Compressed Archive 168.84 MB Download (sha256)
    ARM64 DMG Installer 168.24 MB Download (sha256)
    x64 Compressed Archive 170.91 MB Download (sha256)
    x64 DMG Installer 170.32 MB Download (sha256)
    For Linux: Product/File Description File Size Download
    ARM64 Compressed Archive 172.92 MB Download (sha256)
    ARM64 RPM Package 172.62 MB Download (sha256)
    x64 Compressed Archive 174.33 MB Download (sha256)
    x64 Debian Package 149.69 MB Download (sha256)
    x64 RPM Package 174.03 MB Download (sha256)
    For Windows: Product/File Description File Size Download
    x64 Compressed Archive 172.87 MB Download (sha256)
    x64 Installer 153.92 MB Download (sha256)
    x64 MSI Installer 152.67 MB Download (sha256)
  2. Update JAVA_HOME:
    After downloading and installing JDK 17, update your JAVA_HOME variable in your .bash_profile by adding the following lines:

    
    export ANDROID_HOME=~/Library/Android/sdk
    export PATH=$PATH:$ANDROID_HOME/emulator
    export PATH=$PATH:$ANDROID_HOME/tools
    export PATH=$PATH:$ANDROID_HOME/tools/bin
    export PATH=$PATH:$ANDROID_HOME/platform-tools
    export JAVA_HOME=$(/usr/libexec/java_home -v 17)
    export PATH=$PATH:$JAVA_HOME/bin
    export NODE_OPTIONS=--openssl-legacy-provider
    Make sure to run the following command to apply the changes immediately:

bash Copy code export JAVA_HOME=$(/usr/libexec/java_home -v 17) Verify Installation: You can verify that JDK 17 is correctly set up by running:

bash Copy code java -version You should see output indicating that JDK 17 is in use.

davidliu commented 1 month ago

Would anyone have a project reproing this issue? I haven't been able to repro this.

Also, Java 17 is highly recommended for Expo 50+ (not just for this plugin, but for Expo itself). You can follow the instructions given by @boussaidev, or Expo's instructions found here. Android Studio also includes JDK 17, so you can use that as well (on Macs, usually found at /Applications/Android Studio.app/Contents/jbr/Contents/Home).

Jonatthu commented 1 month ago

I was able to fix it when I deleted all java sdk's and only install one