7

I tried to add a wear module to my existing app, tried a lot of solutions, but can't figure out why my app is not being installed on my watch.

What I tried :

First, Manual packaging with my app : https://developer.android.com/training/wearables/apps/packaging.html

But I quickly decided not to go through this.

Then I decided to go to gradle include, so to the build.gradle of app, I added the following to the end of dependencies :

debugWearApp project(path:':wear', configuration: 'flavor1Debug')
releaseWearApp project(path:':wear', configuration: 'flavor1Release')

To the build.gradle of wear, I added the following to the beginning of dependencies :

wearApp project(':wear')

Then, in android{} section of wear build.gradle, just after buildToolsVersion, I added the following :

publishNonDefault true

What I have seen :

  • No problem to install the wear app to the wear using bluetooth debug of the wear

Then, when I install a generate a release version of my app, I can see in raw, that it has been added a file android_wear_micro_apk.apk to res/raw which is my watch app. I also saw a file android_wear_micro_apk.xml in res/xml with, from what I guess between hexa codes, the description of wear app.

Then I compare signatures :

keytool -list -printcert -jarfile mobile_app.apk
keytool -list -printcert -jarfile wear_app.apk

Using the wear app generated in res/raw. They exactly have the same signature. Then I compared :

aapt dump badging mobile_app.apk
aapt dump badging wear_app.apk

They have exact same package names and version codes and names.

So, from that :

  • Apk of wear is correctly added
  • Apk of wear is working if installed on the wear using adb and bluetooth debug
  • Both apk have same version code, version name, and package name
  • Wear is not requiring any permission
  • Phone is requesting following permissions
    • android.permission.ACCESS_NETWORK_STATE
    • android.permission.INTERNET
    • com.android.vending.BILLING
    • com.google.android.c2dm.permission.RECEIVE
    • android.permission.VIBRATE
    • android.permission.WRITE_EXTERNAL_STORAGE
    • android.permission.BLUETOOTH
    • android.permission.BLUETOOTH_ADMIN
    • com.samsung.accessory.permission.ACCESSORY_FRAMEWORK
    • com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY
    • com.samsung.WATCH_APP_TYPE.Companion
    • com.samsung.wmanager.ENABLE_NOTIFICATION

I'm really wondering what I could have forgotten.

Thanks for any help

  • 1
    What kind of keys are you using. is it debug or release key ? – Dibzmania Jan 20 '17 at 13:32
  • I use the release key, which is used for both mobile app and wear apks, when I compared both with keytools –  Jan 20 '17 at 13:34
  • Are you sure you are using the release keys and not the auto generated Debug keys ? (I know I am asking it twice), And are you trying to install from Play store or something ? – Dibzmania Jan 20 '17 at 13:39
  • Yes I am sure, as keytools provide me the publisher ... infos of the key, so it is not the auto debug key. I try to install it from the release build –  Jan 20 '17 at 13:41
  • @gahfy ,what device are you using? – Vyacheslav Jan 23 '17 at 10:15
  • @gahfy I mean both handheld and wear – Vyacheslav Jan 23 '17 at 10:15
  • @gahfy , have you tried the other devices? – Vyacheslav Jan 23 '17 at 10:17
  • @gahfy ,what happens when you install realease APK direcly on wear device using adb? – Vyacheslav Jan 23 '17 at 10:18
  • @Vyacheslav I use both Wiko Lenny2 (Android 5.1) and Samsung Galaxy S7 edge, the watch is a Moto 360 (Android 6.0.1). When I install the app directly using bluetooth debug and adb on the watch, it installs and runs nicely on the watch. –  Jan 23 '17 at 10:36
  • @gahfy, so, have you tried to install release apk directly using adb? – Vyacheslav Jan 23 '17 at 18:36
  • @Vyacheslav Yes but when I install release apk using adb on the phone, nothing is installed on the watch. If I install release apk of the watch (extracted from relase apk of the phone) directly on the watch using bluetooth adb, everything works fine –  Jan 24 '17 at 08:11
  • @gahfy thats really really strange. Could you post your gradle scripts for both phone and wear? – Vyacheslav Jan 24 '17 at 08:13
  • I would suggest to reset your wear. If it is possible – Vyacheslav Jan 24 '17 at 08:14
  • Reset connection , reinstall Android wear connection app, etc – Vyacheslav Jan 24 '17 at 08:15
  • I already reset many times both phone and wear –  Jan 24 '17 at 08:19
  • Paste permissions that you are requesting from the phone and wear respectively. – Pravin Divraniya Jan 25 '17 at 14:15
  • I just edit my question with the list of permissions –  Jan 26 '17 at 15:23
  • You don't need to add **wearApp project(':wear')** in build.gradle of wear module, remove it. In case of different build variants just add **debugWearApp project(path:':wear', configuration: 'flavor1Debug') releaseWearApp project(path:':wear', configuration: 'flavor1Release')** in your build.gradle of mobile module. – Pravin Divraniya Jan 27 '17 at 10:22
  • @gahfy Is above solution works? – Pravin Divraniya Jan 30 '17 at 06:23
  • @gahfy if you find an answer please share it so other SO user's can get benefit from it. – Pravin Divraniya Feb 01 '17 at 08:04
  • @PravinD Unfortunately, none of the given answer allowed me to solve this issue –  Feb 01 '17 at 13:11
  • No, I removed wearApp project(':wear') but the app didn't install as well –  Feb 01 '17 at 16:33

3 Answers3

0

According to one of Google’s Android Developer Advocates, Android Wear 2.0 will require completely standalone watch and phone apps, and abandons the system used since the first version of Android Wear that automatically installs Android Wear apps based on the apps you have on your phone. He puts it plainly in reply to another developer in the Android Wear Developers Google+ community (emphasis ours):

A Wear 2.0 user must visit the Play Store on their watch to install apps. There is no auto-install like on Wear 1.X. Wear 2.0 apps get full network access and can be installed completely separately from the handheld app so the focus is much more on standalone Wear apps than the handheld centric 1.X Wear apps.

But what about apps built solely for your watch? Well, there's a whole store worth of apps that go beyond simple notifications and live on the watch itself. Rather oddly, these still have to be installed through your smartphone. For now, at least - the new Android Wear 2.0 update will include functionality for standalone apps.

Vicky Mahale
  • 1,209
  • 11
  • 18
  • Thanks for this information, I was not aware of it, that's why +1. But Android Wear 2.0 has not been released yet, and my watch (Moto 360) is on Android Wear 1.4.0.2580363 –  Jan 23 '17 at 15:10
0

Forum

On the watch:

  • Settings, Un-pair with phone. (Old release of AW may say Factory reset.)

  • Do not set up the watch yet.

On the phone:

  • In Android Wear use the Disconnect... option.

  • In Android Wear, use Settings, Device settings and touch the watch name, Touch FORGET WATCH.

  • Settings, Bluetooth. If you still see the watch, touch Forget... the watch so it no longer appears in the list of paired devices.

  • Settings, Device, Apps, select Google Play Services. Clear cache and Clear data. Uninstall updates.

  • Settings, Device, Apps, select Google App. Clear cache and Clear data. Also Uninstall updates.

  • Settings, Device, Apps, select Android Wear. Clear cache and Clear data. Also Uninstall updates.

  • Play Store, Apps, My apps, touch the Update all button.

W4R10CK
  • 5,502
  • 2
  • 19
  • 30
-1

You may want to check permissions declared in your app. As mentioned in Requesting Permissions on Android Wear regarding mismatching permission models between wearable and handset app,

If your handset app begins using the Android 6.0 (API level 23) model but your wearable app does not, the system downloads the Wear app, but does not install it. The first time the user launches the app, the system prompts them to grant all pending permissions. Once they do so, it installs the app. If your app, for example a watch face, does not have a launcher, the system displays a stream notification asking the user to grant the permissions the app needs.

The suggested solutions in these SO posts might also help:

Community
  • 1
  • 1
Teyam
  • 7,686
  • 3
  • 15
  • 22
  • I was not aware about it, and yes, my application asks for permissions but not immediately after install. I will check it on Monday and will tell you if it was the issue, and if it was will accept answer as solution. +1 btw as I learned something new –  Jan 21 '17 at 09:06
  • Unfortunately, it is not the problem, as on the phone I am using is below 6.0 (Android 5.1) and my watch has 6.0 permssion model –  Jan 23 '17 at 10:09