Closed Flowdalic closed 6 years ago
It's not well documented but to you can create a retrolamda task. Check out the source for the java plugin https://github.com/evant/gradle-retrolambda/blob/master/gradle-retrolambda/src/main/groovy/me/tatarka/RetrolambdaPluginJava.groovy
Thanks for your quick answer. Right now I wonder if I can even achieve what I want to achieve using Retrolambda: Writing Java 8 source code and linking that code against an android.jar
of the corresponding Android API level. For this it seems to the required that retrolambda compiles the Java 8 source to Java 7 class files with simultaneously using the android.jar
as boot classpath. But Retrolambda is only able to desugar Java 8 class files to Java 7 class files. Correct?
The major problem you'll run into is you need certain java 8 classes on the classpath for retrolambda to work. Have you considered using https://github.com/xvik/gradle-animalsniffer-plugin?
AnimalSniffer perfectly solves my use case, Thank you very much for pointing this out.
I've a custom
compileAndroid
task which compiles my library project having the boot classpath set toandroid.jar
of the corresponding minimum required Android API level, this ensures that only available methods are used.But the
compileAndroid
task failesit appears that retrolambda is not applied to the
compileAndroid
task.How do I manually apply it?