Android Wear app not installing through handset

To Answer @odiggity specifically, in build.gradle file of your phone app, you should mention the exact name of the wear app folder. If you created the project in Android Studio, then your build.gradle should look like this:

                      wearApp project(':wear')

This can happen because of the following reasons:

  • Wear & Mobile app’s "permissions" are not same (Wear App permissions should be a subset of Mobile App permissions).

This is not documented anywhere on developers website, however I found this with my personal experience. The reason I can think of behind this restriction is, Google want to prevent sneaky developers to exploit users & their privacy.

  • Package name of Wear & Mobile apps are not matching.
  • VersionNumber & VersionName of both Wear & Mobile app not matching
  • Application ID (build.gradle file) of Mobile & wear app are not matching.
  • by default wearable packages are only included in release builds
  • both apps must be signed with the same key
  • as of Android Studio 3.0 apk builds created with run are test only builds that don’t allow installation on wear (returnCode -15, see this information)
  • Asset Compression

If you are using Eclipse for development, make sure you turn off the “Asset Compression” otherwise the “.apk” file in raw folder will get double compressed & the phone won't be able to recognize if the Mobile app is packaging wear app or not.

Best Solution:

Use Android Studio.

  1. Create Android Project
  2. Select Phone & Wear project
  3. Follow the steps for project creation
  4. Copy all the permissions used in Wear app to Mobile app’s Manifest or vice versa

Debugging

When you don’t find the wear app on the wearable you can always look into logs of both devices to see what is going on. You can filter on WearablePkgInstaller to find all logging related to wearable package installation.

From the Wear OS app on you device trigger the “resync apps” option from “advanced settings” and check the logs. Alternative way to sync only the wearable for your app is to reinstall your app. At that point the wearable is also synced for your package.

Device logging should list something like:

11-07 14:58:53.127 3330-8739/? I/WearablePkgInstaller: Setting DataItem to install wearable apps for com.spotify.music

With com.spotify.music being your app Id. This is just an example for Spotify.

And on the watch (debug over bluetooth or USB) you can find logging with this same filter showing issues or success:

11-07 15:00:02.533 1032-1048/? I/WearablePkgInstaller: Package com.spotify.music was installed.

Most error messages are self explanatory. You can find many examples of these errors in the source code of WearPackageInstallerService class. Some however are just a returnCode. For these return codes check the values in this PackageManager source code.

Leave a Comment