EAS build fails with: Execution failed for task ':expo:compileReleaseKotlin'. [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]

Hello,

i tried to build an android app with the managed workflow, running eas build --platfrom android.

When running gradle it fails with the following error:

Error:

[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ':expo:compileReleaseKotlin'.
[stderr] > Compilation error. See log for more details
[stderr] * Try:
[stderr] 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.
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 9m 27s
Error: Gradle build failed with unknown error. Please see logs for the "Run gradlew" phase.

Complete ErrorMessage:

> Task :expo: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/9a8c596b7e1788d5bad7c80991eefff1/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/d6fde65cea0702b678e59c113b631c89/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-application/android/build/intermediates/compile_library_classes_jar/release/classes.jar!/META-INF/expo-application_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-device/android/build/intermediates/compile_library_classes_jar/release/classes.jar!/META-INF/expo-device_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/android/src/main/java/expo/modules/ApplicationLifecycleDispatcher.kt: (14, 8): Unresolved reference: flatMap
[stderr] e: /home/expo/workingdir/build/node_modules/expo/android/src/main/java/expo/modules/ApplicationLifecycleDispatcher.kt: (14, 18): Unresolved reference: it
[stderr] e: /home/expo/workingdir/build/node_modules/expo/android/src/main/java/expo/modules/ApplicationLifecycleDispatcher.kt: (15, 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/9a8c596b7e1788d5bad7c80991eefff1/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] e: /home/expo/workingdir/build/node_modules/expo/android/src/main/java/expo/modules/ApplicationLifecycleDispatcher.kt: (15, 27): Unresolved reference: it
[stderr] e: /home/expo/workingdir/build/node_modules/expo/android/src/main/java/expo/modules/ApplicationLifecycleDispatcher.kt: (18, 4): Class 'kotlin.jvm.JvmStatic' 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/9a8c596b7e1788d5bad7c80991eefff1/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/jvm/JvmStatic.class
[stderr] e: /home/expo/workingdir/build/node_modules/expo/android/src/main/java/expo/modules/ApplicationLifecycleDispatcher.kt: (20, 37): 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/9a8c596b7e1788d5bad7c80991eefff1/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] e: /home/expo/workingdir/build/node_modules/expo/android/src/main/java/expo/modules/ApplicationLifecycleDispatcher.kt: (20, 50): 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/9a8c596b7e1788d5bad7c80991eefff1/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] e: /home/expo/workingdir/build/node_modules/expo/android/src/main/java/expo/modules/ApplicationLifecycleDispatcher.kt: (23, 4): Class 'kotlin.jvm.JvmStatic' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.1.

I am using the following package.json:

{
  "name": "example",
  "version": "0.1.0",
  "private": true,
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "dependencies": {
    "@firebase/auth-types": "^0.11.0",
    "@firebase/firestore-types": "^2.5.0",
    "@fortawesome/fontawesome-svg-core": "^1.3.0",
    "@fortawesome/free-brands-svg-icons": "^5.15",
    "@fortawesome/pro-duotone-svg-icons": "^5.15",
    "@fortawesome/pro-solid-svg-icons": "^5.15",
    "@fortawesome/react-fontawesome": "^0.1.18",
    "@fortawesome/react-native-fontawesome": "^0.2.3",
    "@hookform/resolvers": "^2.8.8",
    "@material-ui/core": "^4.12.4",
    "@react-native-async-storage/async-storage": "~1.15.0",
    "@types/dinero.js": "^1.9.0",
    "@types/json-buffer": "^3.0.0",
    "@unimodules/react-native-adapter": "~6.5.0",
    "api": "^4.2.0",
    "browserslist": "^4.20.2",
    "d3-shape": "^2.0.0",
    "deepmerge": "^4.2.2",
    "dinero.js": "^1.9.1",
    "expo": "^44.0.6",
    "expo-app-loading": "~1.3.0",
    "expo-apple-authentication": "~4.1.0",
    "expo-asset": "~8.4.6",
    "expo-auth-session": "~3.5.0",
    "expo-blur": "~11.0.0",
    "expo-cli": "^5.4.3",
    "expo-constants": "~13.0.1",
    "expo-font": "~10.0.4",
    "expo-image-picker": "~12.0.1",
    "expo-linear-gradient": "~11.0.3",
    "expo-linking": "~3.0.0",
    "expo-localization": "~12.0.0",
    "expo-navigation-bar": "~1.1.1",
    "expo-notifications": "~0.14.0",
    "expo-random": "~12.1.1",
    "expo-splash-screen": "~0.14.1",
    "expo-status-bar": "~1.2.0",
    "expo-system-ui": "~1.1.0",
    "expo-updates": "~0.11.7",
    "expo-web-browser": "~10.1.0",
    "firebase": "^8.10.1",
    "history": "^4.0.0",
    "html-entities": "^1.3.1",
    "i18next": "^21.6.16",
    "js-sha256": "^0.9.0",
    "lodash": "^4.17.15",
    "md5": "^2.2.1",
    "moment": "^2.24.0",
    "native-base": "^3.3.11",
    "numbro": "^2.3.1",
    "prop-types": "^15.7.2",
    "react": "17.0.1",
    "react-country-flag": "^2.3.0",
    "react-dom": "17.0.2",
    "react-helmet": "^6.0.0",
    "react-hook-form": "^7.15.3",
    "react-i18next": "^11.16.7",
    "react-native": "0.64.3",
    "react-native-appearance": "~0.3.3",
    "react-native-dialog": "^6.2.0",
    "react-native-dialog-input": "^1.0.8",
    "react-native-draggable-flatlist": "^3.0.5",
    "react-native-gesture-handler": "~2.1.0",
    "react-native-get-random-values": "~1.7.0",
    "react-native-paper": "^4.9.2",
    "react-native-prompt-crossplatform": "^1.6.1",
    "react-native-reanimated": "~2.3.1",
    "react-native-responsive-screen": "^1.4.1",
    "react-native-safe-area-context": "3.3.2",
    "react-native-super-grid": "^4.0.3",
    "react-native-svg": "12.1.1",
    "react-native-svg-charts": "^5.4.0",
    "react-native-svg-transformer": "^0.14.3",
    "react-native-toast-message": "^2.0.2",
    "react-native-vector-icons": "^8.1.0",
    "react-native-web": "0.17.7",
    "react-redux": "^7.2.5",
    "react-redux-firebase": "^3.10.0",
    "react-router": "^5.2.0",
    "react-router-dom": "^5.2.0",
    "react-router-native": "^5.2.0",
    "redux": "^4.1.1",
    "redux-cookies-middleware": "^0.2.1",
    "redux-firestore": "^0.15.0",
    "redux-thunk": "^2.3.0",
    "semver": "^7.1.3",
    "sentry-expo": "^4.0.0",
    "url-parse": "^1.5.3",
    "use-deep-compare-effect": "^1.3.1",
    "uuid": "^3.0.0",
    "yup": "^0.32.9"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/preset-typescript": "^7.16.7",
    "@expo/webpack-config": "~0.16.2",
    "@testing-library/jest-native": "^3.3.0",
    "@testing-library/react-hooks": "^3.4.1",
    "@testing-library/react-native": "^7.0.1",
    "@types/d3-shape": "^1.3.2",
    "@types/jest": "^24.0.0",
    "@types/lodash": "^4.14.149",
    "@types/md5": "^2.1.33",
    "@types/numbro": "^1.9.3",
    "@types/react": "~17.0.21",
    "@types/react-dom": "^18.0.2",
    "@types/react-helmet": "^5.0.15",
    "@types/react-native": "~0.64.12",
    "@types/react-native-svg-charts": "^5.0.3",
    "@types/react-redux": "^7.1.5",
    "@types/react-router-dom": "^5.1.3",
    "@types/semver": "^7.1.0",
    "@types/url-parse": "^1.4.3",
    "@types/uuid": "^7.0.2",
    "@types/yup": "^0.29.13",
    "@typescript-eslint/eslint-plugin": "^3.8.0",
    "@typescript-eslint/parser": "^3.8.0",
    "@welldone-software/why-did-you-render": "^4.0.5",
    "babel-plugin-inline-react-svg": "^2.0.1",
    "eas-cli": "^0.52.0",
    "eslint": "^7.6.0",
    "eslint-config-prettier": "^6.11.0",
    "eslint-plugin-prettier": "^3.1.4",
    "eslint-plugin-react": "^7.20.5",
    "eslint-plugin-react-hooks": "^4.0.8",
    "expo-application": "~4.1.0",
    "expo-device": "~4.2.0",
    "expo-optimize": "^0.2.15",
    "firebase-tools": "^10.6.0",
    "husky": "^4.2.3",
    "i18next-parser": "^6.3.0",
    "jest": "^26.6.3",
    "jest-expo": "^44.0.0",
    "lint-staged": "^10.0.8",
    "node-sass": "^7.0.1",
    "prettier": "^2.0.5",
    "react-native-modal": "^11.5.6",
    "react-test-renderer": "~16.13.1",
    "redux-devtools-extension": "^2.13.8",
    "sharp-cli": "^1.14.1",
    "ts-jest": "^24.0.0",
    "typescript": "~4.3.5"
  }
}

Does somebody has an idea what i could do to fix the issue?

Thank you!

Hi @erik.bergmeyer

I can’t install those dependencies. If I try I get the following error:

% yarn
yarn install v1.22.18
[1/4] 🔍  Resolving packages...
warning @fortawesome/fontawesome-svg-core@1.3.0: Please upgrade to 6.1.0. https://fontawesome.com/docs/changelog/
warning @fortawesome/fontawesome-svg-core > @fortawesome/fontawesome-common-types@0.3.0: Please upgrade to 6.1.0. https://fontawesome.com/docs/changelog/
error An unexpected error occurred: "https://registry.yarnpkg.com/@fortawesome%2fpro-duotone-svg-icons: Not found".
info If you think this is a bug, please open a bug report with the information provided in "/Users/michael/work/personal/scratch/deps/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

I also get something similar with npm. So I don’t know how the EAS Build managed to install these dependencies.

If I remove the fortawesome dependencies, then I get various warnings. You might be able to ignore most of them :man_shrugging:, but not the one about @unimodules/react-native-adapter:

warning @unimodules/react-native-adapter@6.5.0: replaced by the 'expo' package, learn more: https://blog.expo.dev/whats-new-in-expo-modules-infrastructure-7a7cdda81ebc

This was replaced in Expo SDK 43 (see the Expo SDK 43 release announcement), and I believe you shouldn’t need to install it in a managed app anyway. Try removing it.

Also, I am pretty sure, even with the new “Versioned Expo CLI” you shouldn’t have expo-cli as a dependency. Maybe as a devDependency. But unless you’re testing the versioned Expo CLI, I would just remove this.

You also have some stuff in devDependencies that looks to me like it should be in dependencies, but since it was working for you, maybe you’re not actually using them at all.
e.g. react-native-modal and expo-device
I also don’t think you need expo-application installed manually.

yarn outdated or npm outdated show a large number of outdated dependencies, although some (in particular the expo-*, react-native, react-dom and react-native-web should not be updated. expo doctor will tell you if there’s a problem with the versions of those dependencies.)

So I suggest you start by removing the unimodules dependency. Then see if there’s other stuff you’re not actually using that you can get rid of. See if it builds after that.

2 Likes

@wodin thanks that helped !

1 Like