For basic compatibility testing, you can use your current APK and a supported watch or an emulator.
You don't necessarily need to update your full development environment for basic testing. To simply test your app's compatibility with a preview system image, see Wear OS preview downloads.
However, to develop apps, you need to update your development environment, as described below.
Install Android Studio and the latest packages
- For compatibility with Android P, install the latest version of Android Studio.
- Use the SDK manager to install or confirm that you have the latest installations of the following package:
- Under the SDK Platforms tab: Android P
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 'android-P'. -
In the
android
section, update thetargetSdkVersion
to 'P'. -
In the
dependencies
section, update the existing reference to the Wearable Support Library by changing it to the following:compile 'com.google.android.support:wearable:2.3.0'
This requires that the installed Google Repository is the latest version.
- See the instructions at Wear OS preview downloads for setting up a watch or emulator with the preview system image, in order to begin testing your app.
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 Android P APIs in a phone app, then the Minimum SDK option list, select API P.
- Select the Wear option, and in the Minimum SDK option list, select the latest available (API P) 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 'android-P'. -
In the
android
section, update thetargetSdkVersion
to 'P'. -
In the
dependencies
section, update the existing reference to the Wearable Support Library by changing it to the following:compile 'com.google.android.support:wearable:2.3.0'
This requires that the installed Google Repository is the latest version.
- See the instructions at Wear OS preview downloads for setting up a watch or emulator with the preview system image, in order to begin testing your app.