infinitered / ir-docs

Omnibus Documentation for Infinite Red Opensource
18 stars 5 forks source link

Build fails with error: Inconsistent JVM-target #49

Closed aabmets closed 2 weeks ago

aabmets commented 2 weeks ago
PS C:\Projects\myapp> npx expo run:android
(node:21056) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
› Building app...
Configuration on demand is an incubating feature.

> Configure project :app
 Ōä╣’ĖÅ  Applying gradle plugin 'expo-dev-launcher-gradle-plugin' (expo-dev-launcher@4.0.20)

> Configure project :expo

Using expo modules
  - infinitered-react-native-mlkit-core (2.0.0)
  - infinitered-react-native-mlkit-document-scanner (2.0.0)
  - expo-asset (10.0.9)
  - expo-constants (16.0.2)
  - expo-dev-client (4.0.18)
  - expo-dev-launcher (4.0.20)
  - expo-dev-menu (5.0.15)
  - expo-file-system (17.0.1)
  - expo-font (12.0.7)
  - expo-image (1.12.12)
  - expo-json-utils (0.13.1)
  - expo-keep-awake (13.0.2)
  - expo-manifests (0.14.3)
  - expo-media-library (16.0.3)
  - expo-modules-core (1.12.15)

> Task :infinitered-react-native-mlkit-document-scanner:compileDebugKotlin FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':infinitered-react-native-mlkit-document-scanner:compileDebugKotlin'.
> Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (17) and 'compileDebugKotlin' (21).

  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 determine 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_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 53s
277 actionable tasks: 23 executed, 254 up-to-date
Error: C:\Projects\myapp\android\gradlew.bat app:assembleDebug -x lint -x test --configure-on-demand --build-cache -PreactNativeDevServerPort=8081 -PreactNativeArchitectures=arm64-v8a,armeabi-v7a exited with non-zero code: 1
Error: C:\Projects\myapp\android\gradlew.bat app:assembleDebug -x lint -x test --configure-on-demand --build-cache -PreactNativeDevServerPort=8081 -PreactNativeArchitectures=arm64-v8a,armeabi-v7a exited with non-zero code: 1
    at ChildProcess.completionListener (C:\Projects\myapp\node_modules\@expo\spawn-async\build\spawnAsync.js:42:23)
    at Object.onceWrapper (node:events:635:26)
    at ChildProcess.emit (node:events:520:28)
    at cp.emit (C:\Projects\myapp\node_modules\cross-spawn\lib\enoent.js:34:29)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5)
    ...
    at spawnAsync (C:\Projects\myapp\node_modules\@expo\spawn-async\build\spawnAsync.js:7:23)
    at spawnGradleAsync (C:\Projects\myapp\node_modules\@expo\cli\build\src\start\platforms\android\gradle.js:96:48)
    at assembleAsync (C:\Projects\myapp\node_modules\@expo\cli\build\src\start\platforms\android\gradle.js:74:18)
    at runAndroidAsync (C:\Projects\myapp\node_modules\@expo\cli\build\src\run\android\runAndroidAsync.js:45:37)
aabmets commented 2 weeks ago

The app compiles successfully if I uninstall the @infinitered/react-native-mlkit-document-scanner library.

aabmets commented 2 weeks ago

The error was fixed when I downgraded Java version from 21 to 17.
Expo recommends version 17 anyways and I didn't RTFM enough when setting up local build.