Error

Solution
Changing this in the file build.gradle solved my problem.
From
ext.kotlin_version = '1.3.50'Code language: JavaScript (javascript)
to
ext.kotlin_version = '1.6.0'Code language: JavaScript (javascript)
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: