Does Java 8 work on Android api 24 and above Or you can use in lower api?

user2577907 picture user2577907 · Mar 11, 2016 · Viewed 11.8k times · Source

In android based on this page Java 8 Languages Features does android work only in api 24 and above or you can use in api lower than api 24 and if you can use this features, which smallest version of api in android support these features

Answer

tknell picture tknell · Mar 11, 2016

Update: Beginning with Android Studio 2.4, the Jack compiler will be deprecated and Java 8 Support will be integrated in the default build chain. Some Java 8 features are available on any API level, some are still limited to API >= 24, see:

https://developer.android.com/studio/preview/features/java8-support.html

Old answer:

The Java 8 features are available beginning from API level 9, but only if you use Android Studio 2.1 (preview) and the Android N Preview SDK

http://android-developers.blogspot.de/2016/03/first-preview-of-android-n-developer.html

Improved Java 8 language support - We’re excited to bring Java 8 language features to Android. With Android's Jack compiler, you can now use many popular Java 8 language features, including lambdas and more, on Android versions as far back as Gingerbread. The new features help reduce boilerplate code. For example, lambdas can replace anonymous inner classes when providing event listeners. Some Java 8 language features --like default and static methods, streams, and functional interfaces -- are also now available on N and above. With Jack, we’re looking forward to tracking the Java language more closely while maintaining backward compatibility.