[Expo 49] Android build fails with kotlin version incompatibility error

Please provide the following:

  1. SDK Version: 49
  2. Platforms(Android/iOS/web/all): Android
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

After upgrading to Expo SDK 49 I see many errors when building Android project

[RUN_GRADLEW] e: /private/var/folders/zg/bxg4djw17bn_36b658hnp0380000gn/T/eas-build-local-nodejs/67dea9b4-e73e-4cfa-bd2c-8949ecb878c0/build/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/views/ViewTypeConverter.kt: (20, 11): Class ‘kotlin.Unit’ was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.

What could be the root cause and how to fix this issue?
I see that in version 49 there is an upgrade to Gradle 8, but not sure if any external packages needs to be migrated / updated as well?

Thanks!

Just to add to this in case it will help with this issue. Also getting this exact error.

System:
    OS: macOS 13.5
    CPU: (8) arm64 Apple M1
    Memory: 110.13 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 16.15.1 - /usr/local/bin/node
    Yarn: 1.22.19 - ~/.yarn/bin/yarn
    npm: 8.11.0 - /usr/local/bin/npm
    Watchman: 2023.07.10.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.12.1 - /Users/techprod/.rbenv/shims/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
    Android SDK:
      API Levels: 28, 29, 30, 31, 32, 33
      Build Tools: 30.0.3, 33.0.0, 33.0.1, 33.0.2
      System Images: android-24 | Google APIs ARM 64 v8a, android-27 | Google APIs ARM 64 v8a, android-28 | Google ARM64-V8a Play ARM 64 v8a, android-29 | ARM 64 v8a, android-29 | Google APIs ARM 64 v8a, android-29 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom_64, android-29 | Google Play ARM 64 v8a, android-31 | ARM 64 v8a, android-31 | Google APIs ARM 64 v8a, android-33 | Google APIs ARM 64 v8a
      Android NDK: Not Found
  IDEs:
    Android Studio: 2022.3 AI-223.8836.35.2231.10406996
    Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.18 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0 
    react-native: 0.71.11 => 0.71.11 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

build.gradle

buildscript {
    ext {
        buildToolsVersion = "33.0.2"
        kotlinVersion = '1.6.20'
        minSdkVersion = 23
        compileSdkVersion = 33
        targetSdkVersion = 33
        ndkVersion = "25.2.9519653"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath('com.android.tools.build:gradle:7.4.1')
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath("com.google.gms:google-services:4.3.10")
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
    }
}

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