Questions tagged [retrolambda]

Retrolambda is a backport of Java 8's lambda expressions to Java 7, 6 and 5

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. After the transformation they are just a bunch of normal .class files, without any additional runtime dependencies.

The GitHub project can be found here: https://github.com/orfjackal/retrolambda

103 questions
43
votes
2 answers

Retrolambda: Lint crashes when using lambda expressions with retrolambda

I'm trying to use retrolambda along with gradle-retrolambda plugin. In general it works fine, but when I compile for release, the lint stage fails with exception: :playground.dagger:lintVitalReleaseFailed converting ECJ parse tree to Lombok for file…
35
votes
2 answers

Do Java8 lambdas maintain a reference to their enclosing instance like anonymous classes?

We know that anonymous classes maintain a reference to their enclosing instance and that this can lead to context leaks on Android. Since retrolambda backports lambdas to Java7, it could be worth a try. It seems that Java8 lambdas do not have this…
Renaud Cerrato
  • 1,297
  • 16
  • 20
32
votes
6 answers

Is there a way to use Java 8 functional interfaces on Android API below 24?

I can use retrolambda to enable lambdas with Android API level <24. So this works myButton.setOnClickListener(view -> Timber.d("Lambdas work!")); This also works Runnable runLater = () -> Timber.d("Lambdas work!"); runLater.run(); But this one…
sasha199568
  • 1,143
  • 1
  • 11
  • 33
31
votes
5 answers

AndroidHttpClient not found (when running Robolectric)

I've set up a very simple project to test the integration of Robolectric + Data Binding + Retrolambda. When I run the test suit, I get the following message: Error:(30, 30) Gradle: error: cannot access AndroidHttpClient class file for…
Technocrat
  • 381
  • 1
  • 3
  • 6
22
votes
4 answers

Retrolambda - Jack is required to support java 8 - warning fix

Is there a way to disable warning about Jack is required to support java 8 language features. while using Retrolambda? I don't want jack support for now since it doesn't yet compile our project.
miszmaniac
  • 825
  • 2
  • 10
  • 21
15
votes
1 answer

Replace Retrolambda with Android Studio 3.0 Java 8 built-in features

In my project I'm using popular library retrolambda. I've just downloaded new Android Studio 3.0 Canary 1. I've updated my project to use new version of Gradle etc. And everything is OK. What's new in Android Studio 3 is built in support for some…
adek
  • 3,045
  • 2
  • 27
  • 41
15
votes
3 answers

How to run 2 queries sequentially in a Android RxJava Observable?

I want to run 2 asynchronous tasks, one followed by the other (sequentially). I have read something about ZIP or Flat, but I didn't understand it very well... My purpose is to load the data from a Local SQLite, and when it finishes, it calls the…
Jaume Colom Ferrer
  • 559
  • 1
  • 5
  • 14
14
votes
1 answer

Lambda expressions crash with IncompatibleClassChangeError in Android when using jack

I am using Java 8 in my Android project. I have setup both Jack (In android application module) and Retrolambda (in other modules). The problem I am having is that my Lambda expressions crash in one specific scenario when I try to make it use class…
Team
  • 181
  • 4
11
votes
3 answers

Use RxJava and Retrofit to iterate through list and augment results based on subqueries

I'm using retrofit and I feel like rxjava (with retrolambda) would be a good fit for the following flow: get list of widgets (http) for each widget a) get a list of articles (http) for the given widget type b) save all those to db c) take the first…
Damian
  • 8,062
  • 4
  • 42
  • 43
10
votes
1 answer

Android build with retrolambda ignores source code changes

In our project we use gradle + retrolambda + proguard. Retrolambda incremental build is set to false. Sometimes build passes without error but source code changes doesn't apply in app. To solve this problem we clean and rebuild project with gradlew…
Pavel M.
  • 263
  • 1
  • 9
9
votes
1 answer

How to specify sourceCompatibility compile options when using the Android Gradle Experimental plugin

I'm currently using the Android Gradle Experimental plugin in one of my apps and I would like to be able to use the retrolambda library. One of the requirements is to specify some compileOptions. In the normal android build plugin, this works: …
hopia
  • 4,880
  • 7
  • 32
  • 54
9
votes
1 answer

android retrolambda, statement lambda can be replaced with expression lambda

I use retrolambda in my project, it works great. but today when i used it, Android Studio give me a tip: I haven't seen this before, how I need to modify the code in order to meet this tip.
L. Swifter
  • 3,179
  • 28
  • 52
8
votes
1 answer

Maven/Retrolambda: how to detect dependencies on Java 8 classes

Background: We have maven-based java project, which targets JRE 1.7, but the source code uses lambdas, so we use retrolambda for transforming Java 8 source code to Java 7. Also we use StreamSupport backport library when we need streams, function.*,…
Denis Itskovich
  • 4,383
  • 3
  • 32
  • 53
8
votes
1 answer

Maven: Using Java 8 libraries in applications instrumented with retrolambda-maven-plugin and DEX-ed with android-maven-plugin

I have written a small set of minilibraries for my internal use. This is set is built using Maven. The libraries are targetted for "regular" Java, GWT and Android. Some of them are written in Java 8 because I hadn't any intention to run them on GWT…
Lyubomyr Shaydariv
  • 20,327
  • 12
  • 64
  • 105
6
votes
0 answers

Android Studio: breakpoint in static method of interface does not work

Android Studio does not stop on lines in a static method of an interface. Example: see method getFilteredNotes in the interface Utils.java of project Conductor (version 0.9.3): public interface Utils { // some lines removed for readability …
TmTron
  • 17,012
  • 10
  • 94
  • 142
1
2 3 4 5 6 7