Java 8 in Android N Preview

The official announcement of Java 8 for Android N Preview says the following:

With the Androids Jack compiler, you can now use many of the popular Java 8 language features, including lambdas and more, on Android versions as far back as Gingerbread . (...) Some features of the Java 8 language — for example, standard and static methods, threads, and functional interfaces — are also now available on N and higher.

I am using the following gradle s configuration minSdkVersion 15to try some Java 8 in a small project:

android {
    compileSdkVersion 'android-N'
    buildToolsVersion '24.0.0 rc1'

    defaultConfig {
        applicationId "org.sergiiz.thermometer"
        minSdkVersion 15
        targetSdkVersion 'N'
        versionCode 1
        versionName "1.0"
        jackOptions{
            enabled true
        }
    }
    compileOptions {
        targetCompatibility 1.8
        sourceCompatibility 1.8
    }
   //...
}

But the target deployment selector shows minSdk(API23, N preview). Is behavior expected?

enter image description here

/ Java 8, Gingerbread, , gradle Java 8 API < 23?

+4
1

minSdk (API23, N ). ?

. N Developer N . targetSdkVersion 'N' minSdkVersion, N.

, gradle libs Java 8 API < 23?

Java 8 , Android N , Android , N.

+2

All Articles