亚行反向TCP在远程连接的Android上不起作用 [英] Adb reverse tcp not working on android connected remotely

查看:103
本文介绍了亚行反向TCP在远程连接的Android上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在远程连接的Android设备上执行反向tcp命令(使用 adb connect< ip-address> )。但是执行时出现以下错误:

I am trying to execute reverse tcp command on a android device connected remotely(using adb connect <ip-address>). But I am getting following error while executing:

adb -s 192.168.0.101 reverse tcp:8081 tcp:8081
error: more than one device/emulator

但我只有一台设备连接。

but I have only one device connected.

adb devices
List of devices attached
192.168.0.101:5555      device

如果我使用USB连接设备,则相同的命令可以正常工作。有任何想法吗?

same command works fine if I connect my device using usb. Any Ideas ?

推荐答案

我只是遇到了这个问题,虽然没有一个答案有效,但我最终还是可以重复使用它。执行以下步骤应该可以让您在真正的Android设备上无线调试React Native应用。

I just came across this, and while none of the answers worked I eventually got it working repeatably. Following these steps should get you wirelessly debugging your React Native app on your real Android device.

我运行了 adb kill-server&&首先使用adb启动服务器。我不确定这是否绝对必要。

I ran adb kill-server && adb start-server first. I'm not sure if that's strictly necessary.


  1. 将手机和计算机连接到同一网络

  2. 通过USB将手机连接到计算机

  3. adb tcpip 5555

  4. adb反向tcp:8081 tcp:5555

  5. adb连接您的PHONE.IP.IP地址:5555

  1. Connect your phone and computer to the same network
  2. Connect your phone to your computer via USB
  3. adb tcpip 5555
  4. adb reverse tcp:8081 tcp:5555
  5. adb connect YOUR.PHONE.IP.ADDRESS:5555

您可以从网络设置-> Wifi-> Wifi首选项-> IP地址中找到手机的wifi IP地址。

You can find your phone's wifi IP address from Network Settings -> Wifi -> Wifi Preferences -> IP Address.


  1. 断开USB线的连接。

  2. 如果尚未安装该应用程序已安装,请按照通常通过USB进行操作的方式在手机上安装该应用程序,大多数情况下 react-native运行android

  1. Disconnect the USB wire.
  2. If the app isn't yet installed, install the app on your phone the way you usually do over USB, react-native run android for most cases.

打开应用程序,您将收到无法加载脚本错误。按下重新加载会出现错误无法连接到开发服务器。克服您的绝望并继续前进。

Open the app, and you get an "Unable to load Script" error. Pressing ‘Reload’ gives an error "Could not connect to development server." Overcome your despair and push onwards.


  1. 打开开发人员菜单(在打开React Native应用程序的情况下摇动手机),然后选择开发设置。选择调试服务器主机&菜单中的设备端口。
    查找计算机的IP地址。在电话窗口中输入该地址,然后输入端口号8081: YOUR.COMPUTER.IP.ADDRESS:8081

  2. 现在摇动并重新加载。有时,它什么也没做,所以关闭应用程序然后重新打开就可以了。

在这一点上,您应该看到捆绑器

At this point, you should see the bundler loading up with the familiar green bar.


  1. 摇晃并按远程调试js。

从这里开始,您应该具有正常的调试经验,减去接线。

From here you should have your normal debugging experience, minus the wire.

这篇关于亚行反向TCP在远程连接的Android上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆