prints error: Cannot resolve symbol 'ModuleDescriptor'. Tried with JDK 11 and 18. What am I doing wrong?
prints error: Cannot resolve symbol 'ModuleDescriptor'. Tried with JDK 11 and 18. What am I doing wrong?
You are not changing the Java version for your project - you are changing the Java version that Gradle should use (as indicated by the "Gradle JVM" label before the dropdown selector).
If you want your project to use Java 18 you must change it under "File" -> "Project Structure" (which opens the Project Settings) and there under the tab "Project", entry "SDK".
As per the docs https://docs.oracle.com/javase/9/docs/api/java/lang/module/ModuleDescriptor.html
ModuleDescriptor is in JDK 1.9 . You can download JDK from here https://www.oracle.com/ca-en/java/technologies/javase/javase9-archive-downloads.html
then import it in your android studio.