EAS build failing with SDK 46 and @segment/analytics-react-native

  • Workflow: managed
  • eas-cli version: eas-cli/0.57.0 darwin-x64 node-v14.17.6

We were using expo-analytics-segment package in our project but expo SDK 46 dropped this package in favor of @segment/analytics-react-native. We have been using Expo GO app in development but @segment/analytics-react-native does not work with Expo Go. So we were trying to use custom dev client but the build always fails with the following error.

[stderr] 
Note: Some input files use or override a deprecated API.
[stderr] 
Note: Recompile with -Xlint:deprecation for details.
[stderr] 
Note: /home/expo/workingdir/build/node_modules/react-native-webview/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java uses unchecked or unsafe operations.
[stderr] 
Note: Recompile with -Xlint:unchecked for details.
> Task :segment_sovran-react-native:compileDebugKotlin 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/0485c57e77da2d74e4400ab5f4119067/transformed/jetified-kotlin-stdlib-jdk8-1.6.10.jar!/META-INF/kotlin-stdlib-jdk8.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.1.15.
[stderr] 
e: /home/expo/.gradle/caches/transforms-3/71974a8810180bf42d7354e2ae463e17/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.1.15.
[stderr] 
e: /home/expo/.gradle/caches/transforms-3/76ffa0bc7ee35e73adab5c035a9c7f86/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.1.15.
[stderr] 
e: /home/expo/.gradle/caches/transforms-3/f071454833bdb79880dbd1d108c1feeb/transformed/jetified-react-native-0.69.4-debug-api.jar!/META-INF/ReactAndroid_debug.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.1.15.
[stderr] 
e: /home/expo/.gradle/caches/transforms-3/f9a6c4180d9d810f143b823eeeb39ba3/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.1.15.
[stderr] 
e: /home/expo/workingdir/build/node_modules/@segment/sovran-react-native/android/src/main/java/com/reactnativesovran/Sovran.kt: (14, 23): Unresolved reference: mutableListOf
[stderr] 
e: /home/expo/workingdir/build/node_modules/@segment/sovran-react-native/android/src/main/java/com/reactnativesovran/Sovran.kt: (18, 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.1.15.
[stderr] 
The class is loaded from /home/expo/.gradle/caches/transforms-3/f9a6c4180d9d810f143b823eeeb39ba3/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] 
e: /home/expo/workingdir/build/node_modules/@segment/sovran-react-native/android/src/main/java/com/reactnativesovran/Sovran.kt: (20, 13): 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.1.15.
[stderr] 
The class is loaded from /home/expo/.gradle/caches/transforms-3/f9a6c4180d9d810f143b823eeeb39ba3/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] 
e: /home/expo/workingdir/build/node_modules/@segment/sovran-react-native/android/src/main/java/com/reactnativesovran/Sovran.kt: (22, 7): 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.1.15.
[stderr] 
The class is loaded from /home/expo/.gradle/caches/transforms-3/f9a6c4180d9d810f143b823eeeb39ba3/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] 
e: /home/expo/workingdir/build/node_modules/@segment/sovran-react-native/android/src/main/java/com/reactnativesovran/Sovran.kt: (24, 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.1.15.
[stderr] 
The class is loaded from /home/expo/.gradle/caches/transforms-3/f9a6c4180d9d810f143b823eeeb39ba3/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] 
e: /home/expo/workingdir/build/node_modules/@segment/sovran-react-native/android/src/main/java/com/reactnativesovran/Sovran.kt: (24, 26): Unresolved reference: it
[stderr] 
e: /home/expo/workingdir/build/node_modules/@segment/sovran-react-native/android/src/main/java/com/reactnativesovran/Sovran.kt: (24, 35): Unresolved reference: it
[stderr] 
e: /home/expo/workingdir/build/node_modules/@segment/sovran-react-native/android/src/main/java/com/reactnativesovran/Sovran.kt: (29, 12): Unresolved reference: listOf
[stderr] 
e: /home/expo/workingdir/build/node_modules/@segment/sovran-react-native/android/src/main/java/com/reactnativesovran/Sovran.kt: (34, 12): Unresolved reference: emptyList
[stderr] 
e: /home/expo/workingdir/build/node_modules/@segment/sovran-react-native/android/src/main/java/com/reactnativesovran/Sovran.kt: (39, 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.1.15.
[stderr] 
The class is loaded from /home/expo/.gradle/caches/transforms-3/f9a6c4180d9d810f143b823eeeb39ba3/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] 
e: /home/expo/workingdir/build/node_modules/@segment/sovran-react-native/android/src/main/java/com/reactnativesovran/Sovran.kt: (40, 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.1.15.
[stderr] 
The class is loaded from /home/expo/.gradle/caches/transforms-3/f9a6c4180d9d810f143b823eeeb39ba3/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] 
e: /home/expo/workingdir/build/node_modules/@segment/sovran-react-native/android/src/main/java/com/reactnativesovran/SovranModule.kt: (15, 28): 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.1.15.
[stderr] 
The class is loaded from /home/expo/.gradle/caches/transforms-3/f9a6c4180d9d810f143b823eeeb39ba3/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] 
e: /home/expo/workingdir/build/node_modules/@segment/sovran-react-native/android/src/main/java/com/reactnativesovran/SovranModule.kt: (25, 33): Unresolved reference: mapOf
[stderr] 
e: /home/expo/workingdir/build/node_modules/@segment/sovran-react-native/android/src/main/java/com/reactnativesovran/SovranModule.kt: (26, 25): Unresolved reference: to
[stderr] 
e: /home/expo/workingdir/build/node_modules/@segment/sovran-react-native/android/src/main/java/com/reactnativesovran/SovranModule.kt: (30, 11): 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.1.15.
[stderr] 
The class is loaded from /home/expo/.gradle/caches/transforms-3/f9a6c4180d9d810f143b823eeeb39ba3/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] 
e: /home/expo/workingdir/build/node_modules/@segment/sovran-react-native/android/src/main/java/com/reactnativesovran/SovranModule.kt: (31, 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.1.15.
[stderr] 
The class is loaded from /home/expo/.gradle/caches/transforms-3/f9a6c4180d9d810f143b823eeeb39ba3/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] 
e: /home/expo/workingdir/build/node_modules/@segment/sovran-react-native/android/src/main/java/com/reactnativesovran/SovranModule.kt: (47, 15): Unresolved reference: mapOf
[stderr] 
e: /home/expo/workingdir/build/node_modules/@segment/sovran-react-native/android/src/main/java/com/reactnativesovran/SovranModule.kt: (48, 16): Unresolved reference: to
[stderr] 
e: /home/expo/workingdir/build/node_modules/@segment/sovran-react-native/android/src/main/java/com/reactnativesovran/SovranModule.kt: (49, 19): Unresolved reference: to
[stderr] 
e: /home/expo/workingdir/build/node_modules/@segment/sovran-react-native/android/src/main/java/com/reactnativesovran/SovranModule.kt: (52, 97): Unresolved reference: java
w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions
[stderr] 
FAILURE: Build failed with an exception.
[stderr] 
* What went wrong:
[stderr] 
Execution failed for task ':segment_sovran-react-native:compileDebugKotlin'.
[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 6m 59s
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 1 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.
578 actionable tasks: 578 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)
Error: Gradle build failed with unknown error. Please see logs for the "Run gradlew" phase.

Here is my package.json file.

{
  "name": "empty-project-template",
  "private": true,
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "eject": "expo eject"
  },
  "dependencies": {
    "@reduxjs/toolkit": "^1.8.1",
    "@segment/analytics-react-native": "^2.5.1",
    "@twilio/conversations": "^2.1.0",
    "assert": "^1.1.1",
    "axios": "^0.18.0",
    "axios-retry": "^3.1.1",
    "expo": "^46.0.0",
    "expo-application": "~4.2.2",
    "expo-av": "~12.0.3",
    "expo-constants": "~13.2.3",
    "expo-dev-client": "~1.1.1",
    "expo-device": "~4.3.0",
    "expo-font": "~10.2.0",
    "expo-image-picker": "~13.3.1",
    "expo-linking": "~3.2.2",
    "expo-localization": "~13.1.0",
    "expo-location": "~14.3.0",
    "expo-notifications": "~0.16.1",
    "expo-permissions": "~13.2.0",
    "expo-store-review": "~5.3.0",
    "expo-tracking-transparency": "~2.3.1",
    "expo-updates": "~0.14.3",
    "expo-web-browser": "~11.0.0",
    "libphonenumber-js": "^1.7.23",
    "lodash": "^4.17.11",
    "lottie-react-native": "5.1.3",
    "moment": "^2.22.2",
    "moment-timezone": "^0.5.23",
    "prop-types": "^15.7.2",
    "react": "18.0.0",
    "react-native": "0.69.4",
    "react-native-awesome-gallery": "^0.2.6",
    "react-native-gesture-handler": "~2.5.0",
    "react-native-ios-picker": "^1.0.0",
    "react-native-iphone-x-helper": "^1.2.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.1",
    "react-native-maps": "0.31.1",
    "react-native-modal": "^6.5.0",
    "react-native-push-notification-popup": "github:toxox/react-native-push-notification-popup",
    "react-native-reanimated": "~2.9.1",
    "react-native-screens": "~3.15.0",
    "react-native-webview": "11.23.0",
    "react-navigation": "^3.0.9",
    "react-redux": "^8.0.1",
    "sentry-expo": "~5.0.0"
  },
  "devDependencies": {
    "babel-eslint": "^10.0.3",
    "eslint": "^6.8.0",
    "eslint-config-airbnb": "^18.0.1",
    "eslint-config-prettier": "^6.9.0",
    "eslint-plugin-import": "^2.20.0",
    "eslint-plugin-jsx-a11y": "^6.2.3",
    "eslint-plugin-react": "^7.18.0",
    "eslint-plugin-react-native": "^3.8.1"
  }
}

This is my eas.json config

{
  "cli": {
    "version": ">= 0.52.0"
  },
  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal"
    }
  }
}

I am trying to build using the following command.

eas build --profile development --platform android --clear-cache

I’m having the EXACT same issue. I even created a new minimal, reproducible example here

this looks like an issue with the segment library. some more context in this thread [Expo v46] sovran-react-native causes Android builds to fail on the latest version of Expo v46.0.0 · Issue #39 · segmentio/sovran-react-native · GitHub

1 Like

Quick little update for me - I was able to get past it by installing the required dep @segment/sovran-react-native The segment docs mention the way to install it:

 yarn add @segment/analytics-react-native @segment/sovran-react-native @react-native-async-storage/async-storage
 # or
 npm install --save @segment/analytics-react-native @segment/sovran-react-native @react-native-async-storage/async-storage

I thought I had previously done this in my original repository but maybe something when wrong the first time I did it.

1 Like