Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15
Error

Solution
Changing this in the file build.gradle solved my problem.
From
ext.kotlin_version = '1.3.50'
to
ext.kotlin_version = '1.6.0'
I had this problem in a Flutter project.
In my case, a line for kotlin-gradle-plugin was missing in the Android build.gradle file, so adding ext.kotlin_version = ‘1.6.10’ didn’t fix it.
After adding
classpath “org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version”
the error was gone.
Full code section: