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:
Detailed information about the Android N APIs is available in the N Preview reference documentation, which you can download from the following table. This package contains an abridged, offline version of the Android developer web site, and includes an updated API reference for the Android N APIs and an API difference report.
| Documentation | Checksums |
|---|---|
| n-preview-3-docs.zip |
MD5: 19bcfd057a1f9dd01ffbb3d8ff7b8d81 SHA-1: 9224bd4445cd7f653c4c294d362ccb195a2101e7 |
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:
To use the Android N APIs, your project must be configured appropriately.
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 'android-N'
buildToolsVersion '24.0.0-rc3'
...
defaultConfig {
minSdkVersion 'N'
targetSdkVersion 'N'
...
}
...
}
To create a new project for development with the Android N Preview SDK: