I tried to add a wear module to my existing application, tried many solutions, but I can’t understand why my application is not installed on my watch.
What I tried:
Firstly, manual packaging with my application: https://developer.android.com/training/wearables/apps/packaging.html
But I quickly decided not to go through this.
Then I decided to switch to gradle include, so in the build.gradle application I added the following to the end of the dependencies:
debugWearApp project(path:':wear', configuration: 'flavor1Debug') releaseWearApp project(path:':wear', configuration: 'flavor1Release')
In build.gradle wear, I added the following to the beginning of the dependencies:
wearApp project(':wear')
Then, in the android{} wear section of build.gradle right after buildToolsVersion I added the following:
publishNonDefault true
What I saw:
- There is no problem installing the wear app using Bluetooth debugging from wear.
Then, when I install the generated version of my application, I can see in raw form that the android_wear_micro_apk.apk file for res / raw was added, which is my watch application. I also saw the android_wear_micro_apk.xml file in res / xml, so that I assume between the hexadecimal codes, the description of the application to wear.
Then I compare the signatures:
keytool -list -printcert -jarfile mobile_app.apk keytool -list -printcert -jarfile wear_app.apk
Using a wearing app created in res / raw. They have exactly the same signature. Then I compared:
aapt dump badging mobile_app.apk aapt dump badging wear_app.apk
They have the same package names and version codes and names.
So from this:
- Wear apk added correctly.
- Wear apk works if it is set to wear using adb and debug debug
- Both apk have the same version code, version name and package name
- Wear does not require any rights.
- The phone asks for the 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 really wonder what I could forget.
Thanks for any help