Bluetooth debugging on android wear failing

2019-08-01 05:16发布

问题:

I've been attempting to debug my android wear app via bluetooth and have been running into a few problems. The main problem is that I'll successfully be running the app and debugging via bluetooth when the connection fails. After the pipe is broken nothing I do seems to get the connection back outside of switching phones. This is obviously not a workable solution, so I was wondering if anyone else had run into any similar problems.

回答1:

After trying all the steps in @Alex Sulivan's answer, I also tried another suggestion from here which was suggested for devs who have previously connected to an emulator.

  1. open Android wear companion app
  2. Go to Settings Click on Emulator
  3. Click 'FORGET WATCH'

This didn't work either!

Finally, changing the last adb command to

adb connect 127.0.0.1:4444 did the job.

Having done all of the steps, I don't know how many were required.



回答2:

I've reached some degree of success by re-setting everything and following the developer guide again to setting up bluetooth.

  • Turn bluetooth debugging off on wear device
  • Turn ADB debugging off on wear device
  • Revoke debugging authorization on wear device (not sure if necessary)
  • Turn bluetooth debugging off on wear app on handheld
  • kill the adb server (adb kill-server)
  • Restart adb server (adb server restart)
  • Turn ADB debugging on on wear device
  • Turn bluetooth debugging on on wear device
  • Turn bluetooth debugging on on wear app on handheld
  • enter adb forwarding commands:

    • adb forward tcp:4444 localabstract:/adb-hub
    • adb connect localhost:4444
  • Pray

These steps have mostly worked for me.



回答3:

Debugging over Bluetooth was always Off for me. Apparently I had to choose a debugging wearable device here:

Android Wear -> Settings (gear icon) -> Debugging over Bluetooth -> Device to Debug

Then all other comments are helpful too.