before i'm use build version gradle 26 but after change buildtoolsversion to 27 like as this image error : error build gradle screenshot
After hours of struggling, I solved it by including the following within app/build.gradle:
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}