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
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.
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.
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:
Android Wear App not installed
Android Wear app not installing through handset
I am creating an app that supports both mobile and wearable.
What I have done so far is:
correctly included wear module in build.gradle as mentioned here
added correct dependedncies and support libraries for wearables
same package name and application id both both - wear and mobile modules
same permissions in both manifest
added meta-data for wearable app launcher icon as suggested here
installed signed apk in device.
But, still my launcher icon is not showing in Android Wear start menu.
I have checked all above mentioned things twice. Is anything missing? Any help will be appreciated.
Our company has a huge complex ant build system for building an enormous suite of dozens and dozens of android projects that all get built into a single .apk.
I would like to incorporate a wearable app into this but I don't know to get the wearable .apk embedded within the mobile .apk.
In Android Studio / Gradle this embedded is automatically handled by simply adding the wear apk as a dependency of the mobile apk within the mobile's build.gradle.
Does anybody know how to get the wear apk embedded within the mobile apk when gradle is not being used?
The Packaging Wearable Apps training has all of the steps for packaging manually:
Include all the permissions declared in the manifest file of the wearable app in the manifest file of the mobile app. For example, if you specify the VIBRATE permission for the wearable app, you must also add that permission to the mobile app.
Ensure that both the wearable and mobile APKs have the same package name and version number.
Copy the signed wearable app to your handheld project's res/raw directory. We'll refer to the APK as wearable_app.apk.
Create a res/xml/wearable_app_desc.xml file that contains the version and path information of the wearable app. For example:
<wearableApp package="wearable.app.package.name">
<versionCode>1</versionCode>
<versionName>1.0</versionName>
<rawPathResId>wearable_app</rawPathResId>
</wearableApp>
Add a meta-data tag to your handheld app's <application> tag to reference the wearable_app_desc.xml file.
<meta-data android:name="com.google.android.wearable.beta.app"
android:resource="#xml/wearable_app_desc"/>
Build and sign the handheld app.
Many of these steps can be done just a single time - the most important step is #3, in which you copy the resulting Wearable APK into the correct place before building your app.
I am creating a watch face for android wear. After creating watch face and reading this, I have generated signed apk for android wear.
But android studio is generating two signed apk: one for mobile device and another for wearable.
I want to pack my wearable app inside my mobile app so that watchface appear on companion app as shown on developer's guide.
I installed mobile-release.apk but when I open it it doesn't showing in companion app or anywhere. Can anyone help me how to install it?
Assuming you use android studio:
Your mobile build.gradle file should have the following dependency:
dependencies {
...
wearApp project(':wear')
}
Go to Build > Generate signed apk. In the first window, select mobile as your module.
Now when the build is complete, the wear module will automatically be embedded into the mobile module. The mobile apk is the one you distribute. Wear can be used for testing.
Hy I am trying to package the wearable app using Android studio 1.0.1 and I am following the steps given on this link https://developer.android.com/training/wearables/apps/packaging.html and I followed the steps over 3 successfully . but when go for 4th step , that is to click the Build menu on AS and to click the signed apk , but after that I got a selection box , weather to sign the mobile apk or to sign the wear app.
Now this is a point which is confusing for me , Should I go for Mobile app and It is all done and I would be able then to install the app on mobile and it will push the wear app to wearable or should I first signed the wear app and then paste this signed app in the mobile app and then select the sign mobile app , ??? what should I do to make it work
I think that my question is quite clear now. waiting for help
You have to simply create a module of your wear app with the same applicationId. In addition you add to your gradle script file of your mobile app:
dependencies {
//something bla bla
wearApp project(':mywearable')
}
Generete from Android Studio menu your release APK for your mobile app. You'll see actually that two apk are generated, the mobile and the wear apk but it's only a convenience for you. If you check the mobile apk you'll see the wear app inside, so don't worry use always to publish the mobile apk.
You should build and sign your just mobile application. Wearable aplication will be signed automatically and introduced inside mobile .apk
You could check this opening the .Apk generated as a .zip. Wear apk will be in res/raw/ folder.