Java "lambda expressions not supported at this language level" Java "lambda expressions not supported at this language level" java java

Java "lambda expressions not supported at this language level"


In IntelliJ IDEA:

In File MenuProject StructureProject, change Project Language Level to 8.0 - Lambdas, type annotations etc.

For Android 3.0+ Go FileProject StructureModuleapp and In Properties Tab set Source Compatibility and Target Compatibility to 1.8 (Java 8)

Screenshot:

enter image description here


You should change source code Language Level also on the Source tab (Modules part).

Change Language Level


This solution works in Android Studio 3.0 or later.

  1. File > Project Structure > Modules > app > Properties tab

enter image description here

Change both of Source Compatibility and Target Compatibility to 1.8

  1. Edit config file

You can also configure it directly in the corresponding build.gradle file

android {  ...  // Configure only for each module that uses Java 8  // language features (either in its source code or  // through dependencies).  compileOptions {    sourceCompatibility JavaVersion.VERSION_1_8    targetCompatibility JavaVersion.VERSION_1_8  }}