14

I just created my first android wear app. I have two modules, mobile and wear. I have on my mobile module a dependency that points to the wear module as described on the documentation. When I generate the apk I end up with two apks, one called mobile and one called wear. Should I just ignore the wear apk or did I not do something right? I think that there should only be one apk.

Chrystian
  • 977
  • 3
  • 11
  • 24

2 Answers2

12

There are two apks because (for debugging/testing) you can (and should) install the wear apk directy on the Android Wear device.

However, when you are going to publish the "Android Wear-ready" app to the Play Store, you should only upload the mobile apk. The other apk is embedded within, and will be automatically pushed to the connected watch.

See Install the Wearable app in the documentation:

When developing, you install apps directly to the wearable like with handheld apps. Use either adb install or the Play button on Android Studio.

When you're ready to publish your app to users, you embed the wearable app inside of the handheld app. When users install the handheld app from Google Play, a connected wearable automatically receives the wearable app.

Note: The automatic installation of wearable apps does not work when you are signing apps with a debug key and only works with release keys. See Packaging Wearable Apps for complete information on how to properly package wearable apps.

matiash
  • 54,791
  • 16
  • 125
  • 154
  • 1
    [Packaging wearable apps](https://developer.android.com/training/wearables/apps/packaging.html) has more details on how to build and package wearable apps. It is worth mentioning that the wearable APK will only be included in the release version of your mobile APK. During development time, you need to deploy each APK individually to the respective device or emulator. This way, you only need to redeploy the part of your app (mobile or wearable) that you actually changed. Faster roundtrips ensue. – Peter Friese Jul 07 '14 at 11:04
  • 2
    Did I understand right that the automatic installation of wearable apps through the installation of the handheld app also does not work if you install the mobile apk "by hand" (not via play store)? It did not seem to work in my case – Thomas May 13 '15 at 13:48
  • @Thomas I had the same problem. Recreating the signed release .apk worked though. I have no idea what was different the second time around. If you checked [these points](http://stackoverflow.com/questions/25004530/android-wear-app-not-installing-through-handset), you might just want to give it another try? I can affirm you that sideloading a correctly packaged .apk will install the embedded wear-release.apk. – dtk May 15 '15 at 01:05
1

Two APKs is exactly what is expected: the wear APK is then embedded into the mobile APK as per the packaging Wear apps training. In release builds, the wear APK is then auto-installed onto the user's Android Wear device. However, as per the note on the packaging page:

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

ianhanniballake
  • 191,609
  • 30
  • 470
  • 443
  • Thank you. I just generated an apk with the wear module dependency and one without it. The generated apk with the wear module dependency is the exact size as mobile apk + wear apk. – Chrystian Jul 06 '14 at 20:37