page.title=Set Up the Preview meta.keywords="preview", "android" page.tags="preview", "developer preview" page.image=images/cards/card-n-sdk_2x.png @jd:body
To develop apps for the Android N Preview, you need to make some updates to your developer environment, as described on this page.
To simply test your app's compatibility on the Android N system image, follow the guide to Test on an Android N Device.
The Android N platform adds support for Java 8 language features, which require a new compiler called Jack. The latest version of Jack is currently supported only in Android Studio 2.1. So if you want to use Java 8 language features, you need to use Android Studio 2.1 to build your app. Otherwise, you don't need to use the Jack compiler, but you still need to update to JDK 8 to compile against the Android N platform, as described below.
If you already have Android Studio installed, make sure you have Android Studio 2.1 or higher by clicking Help > Check for Update (on Mac, Android Studio > Check for Updates).
If you don't have it, download Android Studio 2.1 here.
To start developing with Android N APIs, you need to install the Android N Preview SDK in Android Studio as follows:
Beginning with the Preview 4 release, the API reference for the N platform (API level 24) is now available online at developer.android.com/reference/.
If you'd like an offline copy of the API reference, you can download it from the following table. The download also includes an incremental diff report for API changes between the Preview 3 and Preview 4 release, which is not available online.
Documentation | Checksums |
---|---|
n-preview-4-docs.zip |
MD5: f853e3ba0707083336dfa780b8fed9a7 SHA-1: 36fcbc497cc2e63b1bc1d629c304b0ba43a88946 |
To compile your app against the Android N platform and use some tools with Android Studio 2.1, you need to install the Java 8 Developer Kit (JDK 8). So, if you don't already have the latest version, download JDK 8 now.
Then set the JDK version in Android Studio as follows:
Now that the N platform API level is "24" instead of "N", you can configure your projects normally with this API level (and even publish your apps compiled with API 24 on Google Play). Just be sure that you've updated your project to use Android SDK Build Tools 24.0.0 and Android SDK Platform-Tools 24.0.0.
If you plan to use Java 8 language features, you should also read Java 8 Language Features for information about the supported Java 8 features and how to configure your project with the Jack compiler.
Open the
build.gradle
file for your module and update the values as
follows:
android { compileSdkVersion 24 buildToolsVersion '24.0.0' ... defaultConfig { targetSdkVersion 24 ... } ... }
Now that the API level 24 is final, you can compile against it and keep your
minSdkVersion
to whatever version is appropriate for your app.
To create a new project for development with the Android N Preview SDK: