Android Studio is not recognizing features from Java 11+ even though the JDK is version 18. I discovered this when I needed the repeat()
method (introduced in Java 11) and AS would throw Cannot resolve method
, but later tried more features from Java 11 onwards and they weren't recognized.
I set my JDK version and location as follows in the settings (from what I searched, this is the only setting related to JDK in Android Studio). Android Studio JDK Settings
I've reinstalled Android Studio twice, invalidated my caches, redownloaded the JDK twice. Note: IntelliJ IDEA is able to recognize features using the same exact JDK as Android Studio.
Please help if you've ever had this issue because I'm slowly losing my mind over this.