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
  1. Get Android Studio 2.1
  2. Get the Android N SDK
    1. Reference documentation
  3. Get the Java 8 JDK
  4. Update or Create a Project
  5. Next Steps

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.

Get Android Studio 2.1

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.

Get the N Preview SDK

To start developing with Android N APIs, you need to install the Android N Preview SDK in Android Studio as follows:

  1. Open the SDK Manager by clicking Tools > Android > SDK Manager.
  2. In the SDK Platforms tab, select the Android N Preview check box.
  3. Click the SDK Tools tab, then select the Android SDK Build Tools, Android SDK Platform-Tools, and Android SDK Tools check boxes.
  4. Click OK, then accept the licensing agreements for any packages that need to be installed.

Get the N Preview reference documentation

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-2-docs.zip MD5: c02732760f468bd97cd94c1b76361229
SHA-1: 591eabe168c909799f6d8dcbe7b126c25ea8b04d

Get the Java 8 JDK

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:

  1. Open an Android project in Android Studio, then open the Project Structure dialog by selecting File > Project Structure. (Alternatively, you can set the default for all projects by selecting File > Other Settings > Default Project Structure.)
  2. In the left panel of the dialog, click SDK Location.
  3. In the JDK Location field, enter the location of the Java 8 JDK (click the button on the right to browse your files), then click OK.

Update or Create a Project

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.

Update an existing project

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'
     ...
  }
  ...
}

Create a new project

To create a new project for development with the Android N Preview SDK:

  1. Click File > New Project. and follow the steps until you reach the Target Android Devices page.
  2. On this page, select Phone and Tablet option.
  3. Under Phone and Tablet option, in the Minimum SDK option list, select N: Android API 23, N Preview (Preview).

Next Steps