7

Im using android studio and I want to use lambda expression that are available only from java 8, and when I try to use it I get:

Lambda expression are not supported at this language level.

So, how can I change that on AndroidStudio?

1

2 Answers 2

7

So, how can I change that on AndroidStudio?

you can't. Android supports up to java 7. If you want to use AS only for Lambda, you can use gradle-retrolamba or retrolambda, which back-port retrolambda on java 6/7

Sign up to request clarification or add additional context in comments.

Comments

2

Android supports Java 6 up to KitKat (4.4) with some minor syntactic sugar (like diamond operator), and Java 7 from there on (Lollipop and Marshmallow atm). Lambdas and other Java 8 stuff are available only as plugins (e. g. gradle-retrolambda or the original retrolambda). They will probably be included in API at some point in time (like Java 7 and KitKat), but it doesn't seem likely it'll be very soon.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.