Gopi Krishna Gopi Krishna - 12 days ago 5
Java Question

Is Android N Stream API backported to lower versions?

Latest version of Android N has stream package but when i'm trying to use it is saying min Sdk version which i should use is 24 (N) and my min SDK is 16.

I enabled JackOptions with which Lambda expressions , Method References are working fine ( even for versions less than N minsdk) but still has problem is only with Stream package . The link below https://developer.android.com/guide/platform/j8-jack.html says lambda, method references are available to 23 n lower also but no clarity on Stream package.

So i want to understand that Steam package i cannot use in my project ( minsdk 16) ? Or am I missing something .

All sdk components are updated .
compileSdkVersion 24
buildToolsVersion "24.0.2"
minSdkVersion 16
targetSdkVersion 24 (23 doesn't matter )

Please suggest me what i should do . Also i saw streamsupport https://github.com/streamsupport/streamsupport which is working fine but i don't want to add a new dependency.

Answer

Is Android N Stream API backported to lower versions?

No, it is not, at least in terms of literally using java and javax packages, such as java.util.stream. No classes get backported to their original Java packages, as otherwise there are namespace collisions on newer devices.

To date, Google has not released some sort of workalike classes for java.util.stream, etc., as a library, where those classes happen to use a separate Java package.

Comments