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
4 Answers
Answers 1
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.
Answers 2
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:
Answers 3
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.
Answers 4
You aren't required to add wearApp project(':wear')
in your build.gradle
of the wear module
In the case of different build variants just adjust accordingly, in your build.gradle
of the mobile module:
debugWearApp project(path:':wear', configuration: 'flavor1Debug') releaseWearApp project(path:':wear', configuration: 'flavor1Release')
Also, further tips:
- Check your permissions. The Smartphone part needs to have all the permissions the Wear component has.
- use the same package id for both apps (wear and mobile)
Hope this solves it.
0 comments:
Post a Comment