diff --git a/docs/html/preview/setup-sdk.jd b/docs/html/preview/setup-sdk.jd index 7a2a6660c013e..389bcf217c3ad 100644 --- a/docs/html/preview/setup-sdk.jd +++ b/docs/html/preview/setup-sdk.jd @@ -1,4 +1,4 @@ -page.title=Set Up the SDK +page.title=Set Up the Preview SDK page.image=images/cards/card-set-up_16-9_2x.png @jd:body @@ -8,166 +8,254 @@ page.image=images/cards/card-set-up_16-9_2x.png

In this document

    -
  1. Get Android Studio 1.3
  2. -
  3. Get the Android 6.0 SDK
  4. +
  5. Get Android Studio 2.1
  6. +
  7. Get the Preview SDK
  8. +
  9. Get the Java 8 JDK
  10. Create or Update a Project
  11. Set Up for Testing
-

With Developer Preview 3, the official Android 6.0 SDK is now available from the Android SDK -Manager. This document assumes that you are familiar with Android app development, such -as using the Android SDK Manager and creating projects. If you are new to -Android, see Building Your First -App training lesson first.

- - -

Get Android Studio 1.3

+

+ You must have a development enviroment to make use of the Android N Developer + Preview. This document describes how to setup and configure a development + environment so you can use and test the Preview SDK. +

- It is highly recommended that you install the Android Studio 1.3 to work best with - the Android 6.0 SDK. Please update your Android Studio installation to version 1.3 or - higher, or follow the instructions for - Installing Android Studio. + This document assumes that you are familiar with Android app development, + such as using the Android SDK Manager and creating projects. If you are new + to Android, see + Building Your First + App training lesson first.

-

Get the Android 6.0 SDK

+

Get Android Studio 2.1

-

To add the Android 6.0 SDK components to your development environment:

+

+ The Developer Preview is best used with Android Studio 2.1, which is also in + preview status. If you have an existing version of Android Studio you are + using for development, you should install a separate instance of Android + Studio for use with the Preview. This section describes how to install + an instance of Android Studio and update to version 2.1. +

+ +

+ Caution: The canary preview of Android Studio 2.1 is still + in active development. If you are using your primary development machine to + test the developer preview, you should create a second installation of + Android Studio to use for testing the Developer Preview. +

+ +

To install Android Studio and update to version 2.1:

    -
  1. Launch Android Studio 1.3 or higher. +
  2. Download, install, and launch the current version of + Android Studio.
  3. -
  4. Open the Settings window (on Windows, you can do this - by choosing File > Settings). Choose the - Appearance & Behavior > System - Settings > Updates panel. - -

    On Mac OS X, you can find the Appearance & - Behavior panel - in Android Studio's Preferences window.

    +
  5. In Android Studio, open the Settings dialog and in the left + panel, choose Appearance & Behavior > System Settings > + Updates. +
  6. -
  7. On the Updates panel, choose the option for - Automatically check updates for Android SDK: Preview Channel. +
  8. On the Updates panel, make sure the Automatically + check updates for option is selected and choose the + Canary Channel option.
  9. -
  10. Launch the Android SDK Manager. (With Android Studio 1.3, - the SDK Manager is integrated into Android Studio instead of being a - standalone application.) -
  11. - -
  12. Under the Platforms section, select Android 6.0. -
  13. - -
  14. In the Tools section, select the latest Android - SDK Tools, Platform-tools, and - Build-tools. -
  15. - -
  16. Click Install packages and accept the licensing - agreement for all of the packages. -
  17. - -
  18. Verify that the Android 6.0 SDK is installed by opening the - Settings window and choosing the Appearance & Behavior - > System Settings > Android SDK panel.
  19. - -
  20. On the Android SDK panel, choose - the SDK Platforms tab. Android 6.0 should be listed as Installed. Also, open the - SDK Tools tab to verify that the latest tools are - installed. +
  21. On the Updates panel, click Check Now + to check for the latest canary build. Allow the software to download + and install the canary version when prompted.
-

After completing these steps, the preview components are available in your development - environment.

+ + +

Get the Java 8 JDK

+ +

+ You must use the Java 8 Development Kit with the N Developer Preview. If you + do not have this version of the JDK installed, download and install it before + working with the Preview SDK. +

+ +

To set the JDK version in Android Studio:

+ + + + +

Get the Preview SDK

+ +

To add the Preview SDK to your Android Studio 2.1 development + environment:

+ +
    +
  1. Launch Android Studio 2.1. +
  2. + +
  3. In Android Studio, open the Settings dialog and in the left + panel, choose Appearance & Behavior > System Settings > + Updates. + +
  4. + +
  5. On the Updates panel, make sure the Automatically + check updates for Android SDK option is selected and choose the + Preview Channel option. +
  6. + +
  7. In the Settings dialog left panel, choose + Appearance & Behavior > System Settings > + Android SDK. +
  8. + +
  9. Click the SDK Platforms button, and then select + Android N Preview. +
  10. + +
  11. Click the SDK Tools button, and select the latest + Android SDK Tools, Platform-tools, and + Build-tools versions. +
  12. + +
  13. Click OK and then accept the licensing + agreements for the packages to be installed. +
  14. +
+ +

After completing these steps, the preview components are available in your + development environment.

Create or Update a Project

- In order to use the preview APIs, you must create or update a development project to use - the preview components. + In order to use the preview APIs, you must create or update a development + project to use the preview components.

Create a new project

- We recommend using Android Studio to create a project with the preview. Follow the steps - described in Creating a Project - until you arrive at the Form Factors screen in the project wizard. Then perform - the following steps to create a project configured for the preview. + Use the Android Studio new project wizard to create a project. For detailed + information on how to create a project with this too, see + Creating a Project.

- +

To create a new project using the Preview SDK:

+ +
    +
  1. Start the New Project wizard and follow the steps until you reach the + Target Android Devices page. +
  2. +
  3. On this page, select Phone and Tablet option.
  4. +
  5. Under Phone and Tablet option, in the Minimum + SDK option list, select Android N Preview.
  6. +

Update an existing project

- For existing projects, if you are using Android 6.0 APIs (API level 23) you must - modify the project configuration. In your development environment, open the - build.gradle file for your module and - set these values as follows: + For existing projects, you must modify the project configuration to use the + Preview APIs. In your development environment, open the + build.gradle file for your module and set these values as + follows:

- +
+android {
+  compileSdkVersion 'android-N'
+  ...
+
+  defaultConfig {
+     ...
+     minSdkVersion 'N'
+     targetSdkVersion 'N'
+     ...
+  }
+  ...
+}
+

Set Up for Testing

- Testing an app with the preview requires that you have a device or virtual device configured with - the preview version of the platform. If you have a compatible device, you can install the preview - platform for testing. Otherwise, you can configure a virtual device for testing. + Testing an app with the preview requires that you have a device or virtual + device configured with the preview version of the platform. If you have a + compatible device, you can install the preview platform for testing. + Otherwise, you can configure a virtual device for testing.

Set up a physical device

- If you have a Nexus 5, Nexus 6, Nexus 9, or Android TV, you can install a preview - system image on these devices for testing your app. - You can set up a virtual device with the preview version of the platform from within Android Studio - using the Android Virtual Device Manager tool. + If you have a Nexus 5X, Nexus 6P, Nexus 9, or Nexus Player, you can install a + preview system image on these devices for testing your app. You can set up a + virtual device with the preview version of the platform from within Android + Studio using the Android Virtual Device Manager tool.

- Important: Installing a preview image on a device removes all data from - it, so you should backup any data before installing a preview image. + Important: Installing a preview image on a device + removes all data from it, so you should backup any data before + installing a preview image.

Set up a virtual device

- You can set up virtual device with the preview version of the platform from within Android Studio - using the Android Virtual Device Manager tool. + You can set up virtual device with the preview version of the platform from + within Android Studio using the Android Virtual Device Manager tool.

To create an AVD with the AVD Manager:

  1. Install the Preview SDK in your development environment, as described - in Setting Up the Preview - SDK.
  2. + in Setting Up the Preview + SDK.
  3. Follow the steps in - Managing AVDs with AVD - Manager. Use the following settings: + Managing AVDs with AVD + Manager. Use the following settings: