9

I am using jack compiler in my android project. My min sdk is set to 18. I am unable to use forEach and lambda in my code. It asks me to change my min sdk to 24 or higher. I was hoping that with the integration of JACK compiler I would be able to use this forEach with lambda easily. Is there any work around for this other than bumping up the min sdk?

Karu
  • 935
  • 2
  • 13
  • 32
  • 6
    Jack gives you lambdas and method references but it can't magically extend the available API. `forEach` is a default method added to `java.lang.Iterable` in Java 8 (Android API level 24). You'd have to use a backport library to be able use some of the new APIs with min sdk < 24. – Stefan Zobel Feb 16 '17 at 15:42
  • 5
    If you want something `Stream` like on Android 6.x and below you should have a look at the [streamsupport](https://sourceforge.net/projects/streamsupport/) or [LWS](https://github.com/aNNiMON/Lightweight-Stream-API) libraries. – Sartorius Feb 16 '17 at 15:51
  • 4
    Possible duplicate of http://stackoverflow.com/questions/39515035/is-it-possible-to-use-the-java-8-stream-api-on-android-api-24 – apophis Feb 18 '17 at 17:33
  • Possible duplicate of [Is it possible to use the Java 8 Stream API on Android API < 24?](https://stackoverflow.com/questions/39515035/is-it-possible-to-use-the-java-8-stream-api-on-android-api-24) – slartidan Nov 20 '18 at 15:29

0 Answers0