to complement the answer https://stackoverflow.com/a/79301018/17570148:
If you only change the values of the id "com.android.application" version "8.1.0" apply false, and update grladle to 8.3, you may have some problem related to incompatibility between the target JVM versions configured for the Java compiler (in my case; 1.8) and the Kotlin compiler (in my case; 17).
To solve this inconsistency, it is necessary to align the target JVM versions for both compilers. In the android/app/build.gradle file:
android {
...
compileOptions {
sourceCompatibility JavaVersion.VERSION_17 // change the version here (VERSION_17 is my case)
targetCompatibility JavaVersion.VERSION_17 // change the version here (VERSION_17 is my case)
}
// if your file doesn't have this line, you need to add it to ensure that the Kotlin compiler uses the same JVM version as the Java compiler:
kotlinOptions {
jvmTarget = "17" // 17 in my case
}
}