Android Question Lambda expression and Simple Library Compiler


Licensed User
Using OpenJDK 11 and SLC I get this error in some source code I would like to use (steal!). Is there any way to get SLC to permit the use of lambda expressions?
error: lambda expressions are not supported in -source 7
            post(() -> {
  (use -source 8 or higher to enable lambda expressions)


Licensed User
If you are using Android Studio, as I do, then as I mentioned in this thread, you can simply highlight the "->" sign and then press ALT + ENTER and you get an option to automatically convert Lamda into an Anonymous class. This saves you some time rewriting the code.
Don't know if this is available in Eclipse.
Upvote 0


Active Member
Licensed User
Android doesn't support these features. You can compile it with Eclipse however you will then need to desugar the compiled jar:

It is currently not possible to change the source setting in SLC.
It is supported by Android Studio because it is using D8 dexer. I have java application with Lambdas and other java 8 codes and it compiles with Android Studio.
I thought that there will be support for D8 dexer as in your post #10 in this thread
Upvote 0