I have added JAVA 11 to android studio to Build Tools -> Gradle like below:
app/build.gradle:
SDK:
Still when checking source it still shows JAVA 8:
and also when app runs, the features on Java 11 which don’t exist on Java 8 cause the app to fail with missing exception.
java -version shows:
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
OpenJDK 64-Bit Server VM (build 11.0.11+0-b60-7772763, mixed mode)
2
Answers
Try first to invalidate cache and watch carefully with XMLs Android studio need a proper cross checking but strangely its configuration process is not properly align.
If unable to do this restore /Reset Android Studio then Add/Enable JAVA.
Don’t forget to add java version in app level build.gradle file.