EAS build fails (expo-crypto and kotlin compatibility)

Summary

Running eas build fails with the below logs in the “Run gradle” step

View build logs
> Task :expo-constants:javaPreCompileRelease
> Task :expo-constants:compileReleaseJavaWithJavac
> Task :expo-constants:bundleLibRuntimeToJarRelease
> Task :expo-crypto:compileReleaseAidl NO-SOURCE
> Task :expo-crypto:generateReleaseBuildConfig
> Task :expo-crypto:parseReleaseLocalResources
> Task :expo-crypto:generateReleaseRFile
> Task :expo-crypto:compileReleaseKotlin FAILED
[stderr] e: Incompatible classes were found in dependencies. Remove them from the classpath or use '-Xskip-metadata-version-check' to suppress errors
[stderr] e: /home/expo/.gradle/caches/transforms-3/2b1af5f9399fb17298398b88f55cd8d3/transformed/jetified-kotlin-stdlib-jdk7-1.6.10.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.1.
[stderr] e: /home/expo/.gradle/caches/transforms-3/391b3c71caebe9b16d839d51b84fdf1b/transformed/jetified-kotlin-stdlib-1.6.10.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.1.
[stderr] e: /home/expo/.gradle/caches/transforms-3/a7d39c6118917414b1838d435183459d/transformed/jetified-kotlin-stdlib-common-1.6.10.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.1.
[stderr] e: /home/expo/workingdir/build/node_modules/expo-modules-core/android/build/intermediates/compile_library_classes_jar/release/classes.jar!/META-INF/expo-modules-core_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.1.
[stderr] e: /home/expo/workingdir/build/node_modules/expo-crypto/android/src/main/java/expo/modules/crypto/CryptoModule.kt: (21, 44): Unresolved reference: apply
[stderr] e: /home/expo/workingdir/build/node_modules/expo-crypto/android/src/main/java/expo/modules/crypto/CryptoModule.kt: (21, 52): Unresolved reference: update
[stderr] e: /home/expo/workingdir/build/node_modules/expo-crypto/android/src/main/java/expo/modules/crypto/CryptoModule.kt: (21, 64): Unresolved reference: toByteArray
[stderr] e: /home/expo/workingdir/build/node_modules/expo-crypto/android/src/main/java/expo/modules/crypto/CryptoModule.kt: (23, 15): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.1.
[stderr] The class is loaded from /home/expo/.gradle/caches/transforms-3/391b3c71caebe9b16d839d51b84fdf1b/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] e: /home/expo/workingdir/build/node_modules/expo-crypto/android/src/main/java/expo/modules/crypto/CryptoModule.kt: (27, 43): Unresolved reference: digest
[stderr] e: /home/expo/workingdir/build/node_modules/expo-crypto/android/src/main/java/expo/modules/crypto/CryptoModule.kt: (28, 5): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.1.
[stderr] The class is loaded from /home/expo/.gradle/caches/transforms-3/391b3c71caebe9b16d839d51b84fdf1b/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] e: /home/expo/workingdir/build/node_modules/expo-crypto/android/src/main/java/expo/modules/crypto/CryptoModule.kt: (31, 17): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.1.
[stderr] The class is loaded from /home/expo/.gradle/caches/transforms-3/391b3c71caebe9b16d839d51b84fdf1b/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] e: /home/expo/workingdir/build/node_modules/expo-crypto/android/src/main/java/expo/modules/crypto/CryptoModule.kt: (34, 29): Unresolved reference: joinToString
[stderr] e: /home/expo/workingdir/build/node_modules/expo-crypto/android/src/main/java/expo/modules/crypto/CryptoModule.kt: (39, 17): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.1.
[stderr] The class is loaded from /home/expo/.gradle/caches/transforms-3/391b3c71caebe9b16d839d51b84fdf1b/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] e: /home/expo/workingdir/build/node_modules/expo-crypto/android/src/main/java/expo/modules/crypto/CryptoModule.kt: (42, 17): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.1.
[stderr] The class is loaded from /home/expo/.gradle/caches/transforms-3/391b3c71caebe9b16d839d51b84fdf1b/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] e: /home/expo/workingdir/build/node_modules/expo-crypto/android/src/main/java/expo/modules/crypto/CryptoPackage.kt: (8, 80): Unresolved reference: listOf
w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
Execution optimizations have been disabled for 4 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.
275 actionable tasks: 275 executed
Unable to list file systems to check whether they can be watched. The whole state of the virtual file system has been discarded. Reason: Could not query file systems: could not open mount file (errno 2: No such file or directory)
[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ':expo-crypto:compileReleaseKotlin'.
[stderr] > Compilation error. See log for more details
[stderr] * Try:
[stderr] > Run with --stacktrace option to get the stack trace.
[stderr] > Run with --info or --debug option to get more log output.
[stderr] > Run with --scan to get full insights.
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 7m 13s
Error: Gradle build failed with unknown error. Please see logs for the "Run gradlew" phase.

Note:
I scanned the repo issues and found out there are more modules with this error Execution failed for task ':expo-[module-name-here]:compileReleaseKotlin'. And it seems like there is a different version of kotlin needed than what’s running. Is this something related to bigger issue which can be solved within the build infra or does every expo package needs to address it? (Also by looking at other issues such as #13233, #17253, #16291, it seems like they are not fully resolved but the issues were closed)

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

managed

What platform(s) does this occur on?

Android

SDK Version (managed workflow only)

45.0.3

Environment

expo-env-info 1.0.3 environment info:
    System:
      OS: macOS 12.3.1
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 16.14.2 - /usr/local/bin/node
      npm: 8.5.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    Managers:
      CocoaPods: 1.9.1 - /usr/local/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5
      Android SDK:
        API Levels: 26
        System Images: android-26 | Google APIs Intel x86 Atom_64
    IDEs:
      Xcode: 13.3/13E113 - /usr/bin/xcodebuild
    npmPackages:
      babel-preset-expo: ~9.1.0 => 9.1.0
      expo: ~45.0.3 => 45.0.3
      react: 17.0.2 => 17.0.2
      react-native: 0.68.2 => 0.68.2
    npmGlobalPackages:
      expo-cli: 5.3.0
    Expo Workflow: managed

Reproducible demo

(check the logs above)

Related github issue

Hey @madhums, it appears the problem was resolved in your Github Issue so I’m posting here for posterity in case others encounter the same problem.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.