Error:Kotlin: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.16. in spring code example

Example: Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.

what solved my problem is changing this at build.gradle
from
ext.kotlin_version = '1.3.50'
to
ext.kotlin_version = '1.4.32'
or what ever the latest version of Kotlin available and make sure to update Kotlin version on Android Studio as well