Android Java on Android edit

Java 8 features subset with Retrolambda

Retrolambda lets you run Java 8 code with lambda expressions, method references and try-with-resources statements on Java 7, 6 or 5. It does this by transforming your Java 8 compiled bytecode so that it can run on an older Java runtime.

Backported Language Features:

  1. Default methods are backported by copying the default methods to a companion class (interface name + “$”) as static methods, replacing the default methods in the interface with abstract methods, and by adding the necessary method implementations to all classes which implement that interface.
  2. Static methods on interfaces are backported by moving the static methods to a companion class (interface name + “$”), and by changing all methods calls to call the new method location.

Known Limitations:

Retrolambda gradle plugin will automatically build your android project with Retrolambda. The latest version can be found on the releases page.

Usage:

  1. Download and install jdk8
  2. Add the following to your build.gradle
buildscript {
  repositories {
     mavenCentral()
  }

  dependencies {
     classpath 'me.tatarka:gradle-retrolambda:<latest version>'
  }
}

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

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

android {
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

Known Issues:

retrolambda {
  jvmArgs '-noverify'
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:

Java on Android/
Java on Android
Java 8 features subset with Retrolambda

Table Of Contents
39 ACRA
64 Menu
112 Loader
119 Xposed
132 Colors
135 Fresco
140 AdMob
147 Button
156 Vk SDK
170 XMPP
176 OpenCV
200 FileIO
203 Moshi
217 Paint
221 Java on Android
231 AIDL
241 JCodec
243 Okio
255 Looper
  ↑ ↓ to navigate     ↵ to select     Esc to close