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 (preview)

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.

Android Studio 2.1 is currently available as a preview in the canary release channel. If you already have Android Studio and don't want to update to the canary channel, you can download Android Studio 2.1 as a separate installation and use it for development with Android N, leaving your primary Android Studio environment unaffected.

To download Android Studio 2.1 as a separate installation, follow these steps (or if you want to receive Android Studio 2.1 as an update to your existing installation, skip to step 6):

  1. Edit the name of your existing Android Studio installation and append the version number. This way, when you install the new version, it will not override the existing one.
  2. Download the appropriate ZIP file for your operating system from the canary channel download page.
  3. Unzip the package and move the Android Studio 2.1 contents to the appropriate location for applications on your system, then launch it.
  4. In the setup wizard, click Next a couple times to reach the SDK Components Setup screen. Here, you must set a different path for the Android SDK Location. It can be any directory you want, but it must not be the default path, which is the same directory used by your original version of Android Studio (unless you changed that one yourself). The SDK location for Android Studio 2.1 must be different because the N Preview SDK packages are not compatible with versions of Android Studio lower than 2.1.

  5. Continue with the setup wizard until you reach the Android Studio IDE.
  6. Open the Settings dialog (File > Settings on Windows/Linux, or Android Studio > Preferences on Mac). In the left panel, select Appearance & Behavior > System Settings > Updates.
  7. On the Updates panel, select the Automatically check updates for check box and select Canary Channel from the drop-down list.

Keep this settings window open for the next step.

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. While still viewing the Updates panel (step 4 from above), select the Automatically check updates for Android SDK check box and select Preview Channel from the drop-down list.
  2. Click Check Now.
  3. In the left panel, select Appearance & Behavior > System Settings > Android SDK.
  4. Click the SDK Platforms tab, then select the Android N Preview check box.
  5. Click the SDK Tools tab, then select the Android SDK Build Tools, Android SDK Platform-Tools, and Android SDK Tools check boxes.
  6. 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-1-docs.zip MD5: 4ab33ccbe698f46f125cc5b807cf9c2f
SHA-1: 6a3880b3ccd19614daae5a4d0698ea6ae11c20a5

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

  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