I’m trying to run an expo app in Android studio but I’m getting an error related to firebase. Afaik it’s saying I need to update my Java source compatibility level from 11 to 16.
error: pattern matching in instanceof is not supported in -source 11
if (exception instanceof FirebaseAuthUserCollisionException collEx) {
^
(use -source 16 or higher to enable pattern matching in instanceof)
I couldn’t find a solution to this online so I asked ChatGPT which told me to add the following code to build.gradle file but that raised another error, saying Kotlin was improperly placed in compileOptions block.
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_16
targetCompatibility JavaVersion.VERSION_16
}
kotlinOptions {
jvmTarget = '16'
}
}
I asked ChatGPT again and it told me to change the position of KotlinOptions outside the Android block and add a line of code declaring a Kotlin plugin but that also raised an error saying there was no plugin named kotlin-android.
I also tried changing the version of JDK, changing the version of firebase from 19.0.1 to 20.1.0 and changing the version of Java JDK from 18.02.1 to 22.01. But none of this worked. Could you please help me.