I'm doing update of Expo from 48 to 49.0.23 (includes update of React Native from 0.71.8 to 0.72.10).
iOS works fine.
Android ./gradlew build
gets error that I cannot bypass:
Execution failed for task ':expo-modules-core$android-annotation:compileKotlin'.
> Inconsistent JVM-target compatibility detected for tasks 'compileJava' (11) and 'compileKotlin' (17).
My build.gradle has:
buildscript {
ext {
buildToolsVersion = "33.0.0"
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33
ndkVersion = "23.1.7779620"
kotlin_version = '1.8.0'
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath("com.facebook.react:react-native-gradle-plugin")
}
}
app/build.gradle:
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
gradle-wrapper.properties:
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip
I did update of gradle related files according react-native-community update helper. I don't set any specific version of Kotlin in my project (but I also tried enforcing kotlinOptions - didn't work as well).
What am I missing? What could be the reason of Expo package Java versions inconsistency?
I ended up by updating Expo to version 51.0.31 and react-native to version 0.74.5. Issue with Java and Kotlin version was reproducible only on Expo 49 for me (Expo 50 was also working fine).