Trying to build android meet app kotlin error

Hello I’m facing the following error when building the android portion

‘let((T) → R): R’ is only available since Kotlin 1.3.50 and cannot be used in Kotlin 1.3

on line react-native-screens/Screen.kt at 6c87d7749ec62fbb51fb4ec50af1fa8733ebae86 · software-mansion/react-native-screens · GitHub

In Android Studio settings shows using Kotlin 1.6 in the compiler settings and when I set a project variable kotlinVersion in build.gradle to 1.6.10 I still get the same error.

DId you make any changes to the app? We haven’t had any issues building the latest release.

No I hadn’t made any changes. But I found that I only get the error building in android studio, npx react-native run-android works fine.

That’s odd, I build the app with Android Studio and have not seen this :open_mouth:

Ok I found a solution but now facing an other issue.

The solution to get it to build:

buildscript {
    ext.kotlin_version = '1.4.10'
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.2.2'
        classpath 'com.google.gms:google-services:4.3.10'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

ext {
  ...
  kotlinVersion = "$kotlin_version"
}

But when running I face:

I only got the “Unable to load script.” once.

Also ext.kotlin_version = '1.6.10' works as well and you don’t get a warning about 1.4.10 not matching the bundled IDE version.

If you are running the app in debug mode, you need to have the Metro bundler started. This is done by default, a new terminal window should have popped up when you hit run in Android Studio.

1 Like