How to use lambda with Java 7, strange Retrolambda not working

7.1k Views Asked by At

This is rly strange. In official documetation library retrolambda we can read just put this into own gradle:

buildscript {
   repositories {
      mavenCentral()
   }

   dependencies {
      classpath 'me.tatarka:gradle-retrolambda:3.7.0'
   }
}

// Required because retrolambda is on maven central
repositories {
   mavenCentral()
}

apply plugin: 'com.android.application' //or apply plugin: 'java'
apply plugin: 'me.tatarka.retrolambda'

but now when I'm trying to write something with lambda:

btnLogin.setOnClickListener(view -> btnLogin.setVisibility(View.INVISIBLE));

I got from AndroidStudio:

Lambda expression are not supported at language level 1.7

Of course I can set in my build

compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

but this is no sense, now with 1.8 I don't need RetroLambda :)

So question is How to use lambda with Java 1.7 ?

0

There are 0 best solutions below