Skip to content

Most visited

Recently visited

navigation

Set Up the Preview

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

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

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

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.

Update an existing project

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.

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 the Phone and Tablet check box.
  3. Under Phone and Tablet option, in the Minimum SDK option list, select API 24: Android 6.X (N Preview).

Next Steps

This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.