Skip to content

Most visited

Recently visited

navigation

Packaging and Distributing Wear Apps

With Wear 2.0, a user can visit the Play Store on a watch and download a Wear app directly to the watch. Additionally, a user can install an app directly onto their watch via the web Play Store.

All devices that are running Wear 2.0 are using Android 7.1.1 (API level 25). If your app only supports devices running Wear 2.0 or higher, the minimum and target API level should be 25. If your app supports both Wear 1.x and 2.0, the minimum and target API level can be 23. All Wear apps must target API level 23 or higher, so run-time permissions are required.

Also see Standalone Apps.

When a Wear 2.0 app has a companion app, you must use the same key to sign each of the two apps. This requirement also holds true for a Wear 1.x app (which always has a companion app).

Planning for the Play Store

To make your app appear in the on-watch Play Store, you upload the watch APK in the Play Console just as you would any other APK. If you only have a watch APK and no phone APK, no other steps are required.

If you have a phone APK in addition to a watch APK, you must use the Multi-APK delivery method.

Distribution to Wear 2.0 watches

On devices running Wear 2.0, when a user installs a phone app that has an associated watch app (either an embedded APK or an APK uploaded via the Play Console), the user gets a watch notification about the available watch app. Tapping the notification opens the watch Play Store, giving the user the option to install the watch app.

Additionally:

Distribution to Wear 1.x and 2.0 watches

The standard distribution model for Wear 1.x was embedding a watch app inside a phone app. Android Wear now allows you to distribute your Wear app the same way for both Wear 1.0 and 2.0. When a user installs your phone app, if you have a compatible Wear app in the Play Store, it will automatically be installed on Wear 1.0 watches. This feature allows you to stop embedding Wear apps within your phone app's APK. You can provide standalone versions of your watch APK in the Play Store for both Wear 1.0 and Wear 2.0 watches.

Specifying a version code

To ensure that a standalone APK upgrades an existing, embedded Wear APK on a watch, the standalone Wear APK's version code generally should be higher than the embedded Wear APK's version code. (A phone APK's version code scheme can be independent from that of a watch APK, although they must be unique.) However, the version codes of the standalone APK and the embedded Wear APK can be the same if the APKs are equivalent.

If the APKs are not equivalent, but the version codes are the same, then when a watch updates from Wear 1.x to 2.0, the watch may get the new APK only after waiting for a longer-than-expected period of time.

It currently is not possible to create a single APK that works on a phone and watch.

If your Wear APK and companion APK share code and require coordinated releases, you should reserve the last two digits of the version code for APK variants. An example of an APK variant is CPU architecture. See, for example, Supporting multiple CPU architectures.

Here is a suggested version code scheme:

If the example values (25,152, 01, and 00) in this suggested version code scheme are used, the version code for the example APK variant would be 251520100.

Also see Set Application Version Information.

Support in the Gradle file

If you have a Wear app that is intended for both Wear 1.x and Wear 2.0, consider using product flavors. For example, if you want to target both SDK version 23 and version 25, update your Wear module's build.gradle file to include the following if an existing Wear 1.x app has a minimum SDK version of 23:

android {
    // Allows you to reference product flavors in your
    // phone module's build.gradle file
    publishNonDefault true
    ...
    defaultConfig
    {
       // This is the minSdkVersion of the Wear 1.x app
       minSdkVersion 23
       ...
    }
    buildTypes {...}
    productFlavors {
        wear1 {
          // Use the defaultConfig value
        }
        wear2 {
            minSdkVersion 25
        }
    }
}

A build variant is a combination of the product flavor and build type. In Android Studio, select the appropriate build variant when debugging or publishing your app. For example, if wear2 is a product flavor, select wear2Release as the release build variant.

For purposes of code that is Wear 2.0-specific or Wear 1.x-specific, consider source sets for build variants.

Migrating a Wear 1.0 APK from Embedded to Multi-APK

Traditionally, Wear 1.0 APKs were embedded within phone APKs for distributing wearable apps to users. Android Wear now allows you to upload Wear 1.0 APKs directly to the Play Store in lieu of embedding, which helps to decrease phone APK size, and allows for greater flexibility with versioning and releasing APKs. If you have an existing embedded Wear 1.0 APK, you can now follow the steps below to configure, build, and upload it to the Play Store:

  1. Add wearAppUnbundled true to your build.gradle config. This is needed only if you have previously published an embedded Wear app in play store.
  2. android {
      ...
      defaultConfig {
        ...
        wearAppUnbundled true
      }
    }
    
  3. Remove the following wearApp dependency rule from the phone app gradle file:
  4. dependencies {
        ...
        wearApp project(path: ':wear', configuration: 'wear1Release')
    }
    
  5. Ensure that the following feature restriction is specified in your Wear app manifest file:
  6. <manifest package="com.example.standalone"
        xmlns:android="http://schemas.android.com/apk/res/android">
        <uses-feature
            android:name="android.hardware.type.watch"/>
        ...
    </manifest>
    
  7. Set the minimum SDK version to 23 in the build.gradle file of your Wear app module.
  8. Specify the app as standalone.
  9. Build your Wear APK and use the Google Play Developer Console to deploy it.

There are a couple of considerations for setting your Wear app minimum SDK levels:

Setting Up Targeting for a Watch

In your Android manifest file, you must set the uses-feature element to android.hardware.type.watch. Additionally, do not set the required attribute to false. A single APK for Wear and non-Wear devices presently is not supported.

Thus, if an APK has the following setting, Google Play provides the APK to watches only:

<manifest package="com.example.standalone"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-feature
        android:name="android.hardware.type.watch"/>
    ...
</manifest>

The android.hardware.type.watch setting above can be combined with other criteria such as SDK version, screen resolution, and CPU architecture. Thus, different Wear APKs can target different hardware configurations.

Specifying an App as Standalone

Wear 2.0 requires a meta-data element in the Android manifest file of watch apps, as a child of the <application> element. The name of the meta-data element is com.google.android.wearable.standalone and the value must be true or false. The element indicates whether your watch app is a standalone app. If the setting for the element is true, your app can be made available in the Play Store on watches paired to iPhones, as long as your active APKs in all channels (e.g., in the beta channel) have the element set to true. If not all of your APKs (alpha, beta, and production) that currently are served to users have the above setting, your app will be unavailable when a user searches on a watch paired to an iPhone.

A watch app may or may not be considered standalone. A watch app can be categorized as one of the following:

If a watch app is completely independent or semi-independent, set the value of the new meta-data element to true:

<application>
...
  <meta-data
    android:name="com.google.android.wearable.standalone"
    android:value="true" />
...
</application>

Since a standalone app (that is, an independent or semi-independent app) can be installed by an iPhone user or a user of an Android phone that lacks the Play Store, the watch app should be usable without the Android phone app.

If a watch app depends on a phone app, set the value of the above meta-data element to false. Setting the element to false signifies that the watch app should be installed only on a watch that is paired with a phone that has the Play Store.

Note: Even if the value is false, the watch app can be installed before the phone app is installed.

If your Wear 2.0 app has an accompanying phone app, use the same package name for your Wear app and that phone app.

Using the Play Console

You can use the Play Console to upload a standalone Wear APK to an app listing.

Also see Multiple APK Support and Manage Your App. Before uploading an APK as described below, the APK must be signed.

Uploading your APK

In the Play Developer Console, navigate to your application listing and select APK in the left-navigation panel. An APK screen similar to the following is displayed:

alt_text

You may need to use advanced mode for uploads, as follows:

Warning: If you have an existing phone app (in addition to your Wear 2.0 app), you must use advanced mode, which enables you to configure multiple, active APKs.

On the above APK screen, determine whether to click the Switch to advanced mode button by considering the following:

See Simple mode and advanced mode for more information about toggling between modes.

Select a tab (Production, Beta Testing, or Alpha Testing) for your upload. Then click Upload New APK and select your standalone Wear APK for upload.

Reviewing and publishing

After you upload your standalone Wear APK and scroll down on the resulting page, the APK is shown in the Current APK table, with a version number, in a similar way to the following:

alt_text

Finally, in the Current APK table above, click the line with the Version to review the APK. The APK Details panel is displayed. You can verify, for example, that the number in the Supported Android Devices line is far fewer than the number would be for a typical phone APK:

alt_text

When you are ready, publish your app.

Embedding a Wear 1.x APK

The processes in this section are kept for reference purposes. If a Wear 1.x APK is packaged in a phone app APK, the system pushes the Wear app to the paired watch when users download the phone app.

Note: This feature doesn't work when you are signing your apps with a debug key. While developing, installing apps with adb install or Android Studio directly to the watch is required.

Important: It is highly recommended that you create standalone Wear 1.0 APKs and no longer embed your Wear 1.x apps.

Packaging a Wear 1.x app with Android Studio

To package a Wear 1.x app in Android Studio:

  1. Ensure that both the watch and phone app modules have the same package name.
  2. Declare a Gradle dependency in the phone app's build.gradle file that points to the watch app module. The declaration would be similar to the following, but see Set Up Google Play Services and v4 compat library for the latest versions:
    dependencies {
       compile 'com.google.android.gms:play-services-wearable:10.0.1'
       compile 'com.android.support:support-compat:25.1.0'
       wearApp project(':wearable')
    }
    
  3. Follow the instructions in Sign your release build for specifying your release keystore and signing your app. Android Studio exports (into your project's root folder) a signed phone app that includes an embedded watch app.

    Alternatively, sign both apps from the command line using the Gradle wrapper. Both apps must be signed to enable an automatic push of the watch app. See Sign Your App.

Signing the Wear 1.x app and phone app separately

If your build process requires signing the watch app separately from the phone app, you can declare the following Gradle rule in the phone module's build.gradle file to embed the previously-signed watch app:

dependencies {
  ...
  wearApp files('/path/to/wearable_app.apk')
}

You then sign your phone app as desired (with the Android Studio Build > Generate Signed APK... menu item or with Gradle signingConfig rules).

Package a Wear 1.x app manually

You can package a watch app in a phone app manually if you are using another IDE or another method of building:

  1. Ensure that both the watch and mobile APKs have the same package name and version number.
  2. Copy the signed watch app to your phone project's res/raw directory. We'll refer to the APK as wearable_app.apk.
  3. Create a res/xml/wearable_app_desc.xml file that contains the version and path information of the watch app. For example:
    <wearableApp package="wearable.app.package.name">
      <versionCode>1</versionCode>
      <versionName>1.0</versionName>
      <rawPathResId>wearable_app</rawPathResId>
    
    </wearableApp>
    

    The values for the package, versionCode, and versionName are the same as those in the watch app's manifest file. The rawPathResId is the static variable name of the APK resource. For example, for wearable_app.apk, the static variable name is wearable_app.

  4. Add a meta-data tag to your phone app's <application> tag to reference the wearable_app_desc.xml file.
      <meta-data android:name="com.google.android.wearable.beta.app"
                     android:resource="@xml/wearable_app_desc"/>
    
  5. Build and sign the phone app.

Turning off asset compression

Android Studio doesn't compress your APK by default, but if you use another build process, ensure that the watch app is not doubly compressed. Many build tools automatically compress files added to the res/raw directory of an Android app. The watch APK is already zipped, so double compression occurs. As a result, the watch app installer cannot read the watch app, installation fails, and the PackageUpdateService logs the following error: "This file cannot be opened as a file descriptor; it is probably compressed."

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

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

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.

Take a one-minute survey?
Help us improve Android tools and documentation.