2

This is what I did

  1. File->Import Sample
  2. 2 modules created. Application and Wearable
  3. Which one to execute? I tried both anyway
  4. I did not encounter any error
  5. I noticed "Session 'Application' Running" / "Session 'Wearable' Running" on bottom left when I run it enter image description here
  6. But still I cannot see it anywhere both on phone and smartwatch

I read this Setup Android Wear Device

  1. Install the Android Wear app, available on Google Play, on your handheld.
  2. Follow the app's instructions to pair your handheld with your wearable. This allows you to test out synced handheld notifications, if you're building them.
  3. Leave the Android Wear app open on your phone.
  4. Connect the wearable to your machine through USB, so you can install apps directly to it as you develop. A message appears on both the wearable and the Android Wear app prompting you to allow debugging. Note: If you can not connect your wearable to your machine via USB, follow the directions on Debugging over Bluetooth.
  5. On the Android Wear app, check Always allow from this computer and tap OK. The Android tool window on Android Studio shows the system log from the wearable. The wearable should also be listed when you run the adb devices command.

On point number 4 above. How to really connect my smartwatch to my laptop through USB?!?!?

I have Nexus 5 and Moto 360 with latest Android Studio.

stuckedunderflow
  • 3,551
  • 8
  • 46
  • 63

1 Answers1

7

I would double check that debugging in enabled on the wearable and the Android Wear app. Otherwise if you have a Moto 360 the only way you can debug your app on the watch is through bluetooth.

It is important to note that when your app is not signed for production you will have to install the app directly onto the wearable itself.

If you need to connect via bluetooth do the following:

To enable debugging for wear do the following:

  1. On the handheld, open the Android Wear companion app.

  2. Tap the menu on the top right and select Settings.

  3. Enable Debugging over Bluetooth. You should see a tiny status summary appear under the option:

    Host: disconnected

    Target: connected

  4. Connect the handheld to your machine over USB and run:

    adb forward tcp:4444 localabstract:/adb-hub

    adb connect localhost:4444

Note: You can use any available port that you have access to.

Note: if you get unable to connect to localhost:4444: Connection refused. Try running:

adb connect 127.0.0.1:4444

After this if you run adb devices you should see your wearable on the list.

Sudarsan GP
  • 1,194
  • 14
  • 22
Elliott
  • 539
  • 4
  • 14
  • On step 3 I must also enable Debugging on my Moto 360. Must enable Developer option first by tapping the build number 7 times. I have Moto 360, so how to do step number 4? And how to execute that script on step 4? Thanks. – stuckedunderflow Feb 01 '15 at 23:11
  • So with a 360 you basically cannot do step 4. So what you will need to do now is once you have enabled debug both on the wear app and the watch itself open a command line, connect your mobile device to your machine and type the following. `adb forward tcp:4444 localabstract:/adb-hub` `adb connect localhost:4444` Now if you type `adb devices` You should see both your mobile phone and your watch. Go back to AS and when you run your app run the `wear` app and when the picker shows up pick your `Moto 360` from the chooser. – Elliott Feb 01 '15 at 23:16
  • Also side note in your screen shot you are running your mobile app. Make sure you switch to the `Wearable`. Also note that a watch face will not have a intent filter for starting an app so you will need to `Edit Configurations` and check `Do not launch activity` on the wear module so it will deploy. Otherwise you will see a red "X" – Elliott Feb 01 '15 at 23:19
  • Thank You. It is working now. Sorry OOT, as the sample has 2 modules: Application and Wearable. Do we need to run both Application to phone and Wearable to Moto 360? Or just run either Application / Wearable to Moto 360? I kept trying so I lost which way I took to make it run. – stuckedunderflow Feb 02 '15 at 01:29
  • Now, how to remove this sample app from my Moto360? I cannot find a way to do it. – stuckedunderflow Feb 02 '15 at 15:28
  • It ok I got is Thank You – stuckedunderflow Feb 02 '15 at 15:43
  • 1
    @konopko that is because you don't have adb setup for your system environment. http://stackoverflow.com/questions/20564514/adb-is-not-recognized-as-an-internal-or-external-command-operable-program-or – Elliott Mar 10 '15 at 23:11
  • @Elliott May be you can suggest my why I can't see a watch faces of Wear sample app in my Companion app onto handheld? I use Eclipse with ADB, and everything seems fine, project has no errors and run successfully, but no new watch faces appears. Thanks. – Konstantin Konopko Mar 10 '15 at 23:32
  • Are you deploying to the watch directly (Meaning you pick the watch to install on when you run the application)? – Elliott Mar 10 '15 at 23:33
  • @Elliott no, I can't connect my Sony SmartWatch3 via USB, so I trying run wearable app through handheld – Konstantin Konopko Mar 10 '15 at 23:36
  • 1
    That is the problem. In development you need to deploy android wear apps to the wearable directly. Consult my answer above on how to deploy over bluetooth. – Elliott Mar 10 '15 at 23:37
  • @Elliott I've done all the steps 1-4 and `adb devices` show my wear device in the list. But I still can't run app directly to watches: in Eclipse target devices dialog shown only my handheld with wear device ID in suffix. When I run the app, no new watch faces appears on wear device. – Konstantin Konopko Mar 10 '15 at 23:56
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/72710/discussion-between-konopko-and-elliott). – Konstantin Konopko Mar 11 '15 at 00:02