Why can't Android Wear connect to target for Bluetooth debugging?

Whenever I activate Bluetooth debugging on my wearable emulator, the device starts rapping this error every 10 milliseconds on the console:

08-07 12:15:53.472   1484-29405/com.google.android.apps.wearable.settings W/AdbTargetService﹕ error during createTcpConnection
    java.net.ConnectException: failed to connect to localhost/127.0.0.1 (port 7272): connect failed: ECONNREFUSED (Connection refused)
            at libcore.io.IoBridge.connect(IoBridge.java:124)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:183)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:163)
            at java.net.Socket.startupSocket(Socket.java:590)
            at java.net.Socket.tryAllAddresses(Socket.java:128)
            at java.net.Socket.<init>(Socket.java:178)
            at java.net.Socket.<init>(Socket.java:150)
            at com.google.android.clockwork.settings.AdbTargetService$PipeControlThread.createTcpConnection(AdbTargetService.java:203)
            at com.google.android.clockwork.settings.AdbTargetService$PipeControlThread.access$400(AdbTargetService.java:81)
            at com.google.android.clockwork.settings.AdbTargetService$PipeControlThread$2.run(AdbTargetService.java:153)
            at java.lang.Thread.run(Thread.java:818)
     Caused by: android.system.ErrnoException: connect failed: ECONNREFUSED (Connection refused)
            at libcore.io.Posix.connect(Native Method)
            at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:111)
            at libcore.io.IoBridge.connectErrno(IoBridge.java:137)
            at libcore.io.IoBridge.connect(IoBridge.java:122)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:183)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:163)
            at java.net.Socket.startupSocket(Socket.java:590)
            at java.net.Socket.tryAllAddresses(Socket.java:128)
            at java.net.Socket.<init>(Socket.java:178)
            at java.net.Socket.<init>(Socket.java:150)
            at com.google.android.clockwork.settings.AdbTargetService$PipeControlThread.createTcpConnection(AdbTargetService.java:203)
            at com.google.android.clockwork.settings.AdbTargetService$PipeControlThread.access$400(AdbTargetService.java:81)
            at com.google.android.clockwork.settings.AdbTargetService$PipeControlThread$2.run(AdbTargetService.java:153)
            at java.lang.Thread.run(Thread.java:818)
08-07 12:15:53.476    1229-1229/system_process D/ZenLog﹕ disable_effects: 0|com.google.android.apps.wearable.settings|11003|null|1000,listenerHints

      

In my code, I am sending a carry message to a laptop. The message was posted correctly, but the debugger does not stop at any breakpoints in the WearableListenerService class on the portable module and this code does not seem to execute.

Additional Information:

  • Device: Genymotion Samsung Galaxy S4, API 19, 4.4.4.
  • Wearable device: ADV Emulator Square, API 21
  • Same application
  • Same versionNumber
  • The expected project is added as a dependency in the portable project as wearApp project(':wear')

  • No tags <uses-permission>

  • Android Wear installed with apk removes emulator: com.google.android.wearable.app-1.1.1.2016316-702016316-minAPI18
  • Bluetooth debugging enabled on handheld and paired devices
  • Host: connectedTarget: disabled. It doesn't connect when I execute adb -s 192.168.56.102:5555 forward tcp:4444 localabstract:/adb-hub adb connect localhost:4444

    , however the third useless device is created in a permanent offline state and cannot be used to run anything on it:

adb devices Connected devices

Revoking permissions or factory reset (as suggested in the post The Android Wear device selection box says "offline localhost: 4444 minSdk (API 20)> deviceSdk (API 1)" ) works.

+3


source to share


4 answers


It happens that I am all misunderstanding. If you are using emulated wearable media, there is no need:

  • Activate "Bluetooth Debugging" in the wearable.
  • Forward ports with adb -s 192.168.56.102:5555 forward tcp:4444 localabstract:/adb-hub

    and adb connect localhost:4444

    .
  • And even both target and host devices can appear as "disconnected".

All you need to do adb -s handheldDeviceName forward tcp:5601 tcp:5601

is get the Pocket PC to be paired with the emulator, and then you can start debugging without further problems.



The problem is that Android Studio you can debug only one module at a time, with the icon for debugging: Debug icon.

If you want to debug both modules at the same time so that you can track all breakpoints, you have to use the debug button with one module and then attach the debugger to the other device Attach Android process icon to the debugger.

Both devices will be available in a list showing their results after they are paired.

+3


source


I had this problem with moto 360 and solved with this tutorial:

http://melix.github.io/blog/2014/10/android-moto360.html



So you were looking for a solution and here it is. Basically the problem is that the Android companion app doesn't store its settings under its cache. They are stored in the Google Play services space, so here is the procedure that worked for me, and I sincerely hope it works for you. On your PDA:

  • open app settings, search for Android Wear app, then force stop it

  • delete your data and cache

  • Now search for Google Play Services (depending on your language settings, it may appear with a different name on your Google Play Services device.

  • click "Manage Space". You will see that this is a section for connected devices. I tried clearing the data here, but it didn't help, so you have to click to delete all data.

  • restart your phone

  • reboot your Moto 360

I'm not sure if the last two steps are really necessary, but I did it because I wanted to make sure that forced stops and data cleansing did not lead to some weird behavior afterwards. When you open the Android Wear app again, it should look as if you first opened it and asked to associate it with your watch. Do that and you should now follow the normal procedure outlined in the Android documentation and ...

+2


source


If you're on a Mac try this before you start resetting everything unnecessarily (note 127.0.0.1 instead of localhost):

adb forward tcp:4444 localabstract:/adb-hub

adb connect 127.0.0.1:4444

      

+2


source


When localhost

both ::1

(IPv6) and 127.0.0.1

(IPv4) are allowed , connecting to 127.0.0.1

can also help on Linux, not just Mac:

$ adb forward tcp: 4444 localabstract: / adb-hub
$ adb connect localhost: 4444
unable to connect to localhost: 4444: Connection refused
$ adb connect 127.0.0.1:4444
connected to 127.0.0.1:4444
$ adb devices
List of devices attached
127.0.0.1:4444 device
...
$
0


source







All Articles