Edit Module:app build.gradle
If you are using Kotlin
android {
...
kotlinOptions {
jvmTarget = "1.8"
}
}
If you are using Java
android {
...
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}
Or both
android {
...
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
kotlinOptions {
jvmTarget = "1.8"
}
}