If you want an environment for basic compatibility testing of your app, you can use your current APK and a supported watch or an emulator. You don't necessarily need to update your full development environment to do basic testing. To simply test your app's compatibility with a preview system image, see Download and Test with a Device.
However, to develop apps for the Android Wear 2.0 Developer Preview, you need to make some updates to your development environment, as described below.
Install Android Studio and the Latest Packages
1. For compatibility with the N Developer Preview, follow the setup instructions for installing the latest version of Android Studio.
2. Use the SDK manager to install or confirm that you have the latest installations of the following packages:
- Under the SDK Platforms tab:
- Android N Preview
- Under the SDK Tools tab:
- Android Support Library
- Google Play services
- Google Repository
- Android Support Repository
Get the Preview Reference Documentation
Detailed information about the preview is available in the preview reference documentation, which you can download from the following table. The zip file includes an updated API reference for the preview.
Reference documentation | Checksums |
---|---|
wearable-support-preview-2-docs.zip | MD5: afb770c9c5c0431bbcbdde186f1eae06 SHA-1: 81d681e61cee01f222ea82e83297d23c4e55b8f3 |
Update or Create a Project
To use the APIs, your project must be configured appropriately in Android Studio.
Update an existing project
To update an existing project for development:
- Start Android Studio, click Open an existing Android Studio Project, and select a project.
- If prompted by the Android SDK Manager for the SDK version to use for the project, select Use Android Studio's SDK.
- If prompted to update the Gradle plugin, update the version of the plugin.
- In the
build.gradle
file for the Wear module:- In the
android
section, update thecompileSdkVersion
to 24. - In the
android
section, update thetargetSdkVersion
to 24. - In the
dependencies
section, update the existing reference to the Wearable Support Library (for example,compile 'com.google.android.support:wearable:1.4.0'
) by changing it to the following, which requires that your the Google Repository is the latest version:compile 'com.google.android.support:wearable:2.0.0-alpha2'
- In the
- See the following page for setting up a watch or emulator with a preview system image, in order to begin testing your app: Download and Test with a Device
Create a new project
To create a new project for development:
- Click File > New Project and follow the steps in the Create New Project wizard until you reach the Target Android Devices page.
- Optionally, select the Phone and Tablet option. If you plan to use N Preview APIs in a phone app, then the Minimum SDK option list, select API N: Android 6.x (N Preview).
- Select the Wear option, and in the Minimum SDK option list, select the latest available (N Preview) option. Click Next until you exit the Create New Project wizard.
- In the
build.gradle
file for the Wear module:- In the
android
section, update thecompileSdkVersion
to 24. - In the
android
section, update thetargetSdkVersion
to 24. - In the
dependencies
section, update the existing reference to the Wearable Support Library (for example,compile 'com.google.android.support:wearable:1.4.0'
) by changing it to the following, which requires that your the Google Repository is the latest version:compile 'com.google.android.support:wearable:2.0.0-alpha2'
- In the
- See the following page for setting up a watch or emulator with a preview system image, in order to begin testing your app: Download and Test with a Device