完全没有USB电缆的Adb over Wireless,适用于无根电话 [英] Adb over wireless without usb cable at all for not rooted phones
问题描述
我想调试手机(LG nexus 4)上的Android APP.我在旅行,忘记了USB电缆.当我在家工作时,只需连接USB电缆并执行命令"adb tcpip 5555"即可.然后,我可以拔下USB电缆,并通过"adb connect IP"进行连接.
I want to debug Android APPs on my phone (LG nexus 4). I'm travelling and I forgot my USB cable. When I work at home I can do it just connecting the USB cable and executing the command 'adb tcpip 5555'. Then I can unplug the USB cable and connect via 'adb connect IP'.
但是现在我无法执行第一个命令,因为我没有电缆.我不明白为什么每次都必须这样做,因为我之前已经执行过'adb tcpip'命令.
But now I cannot execute the first command because I don't have a cable. I don't understand why I have to do it every time, since I already execute the 'adb tcpip' command before.
我现在尝试的:
我在Android上安装了终端应用程序,并尝试在那里执行该命令,但是收到找不到设备"错误.也许他看不到自己...
I installed a terminal application on my Android and tried to execute that command there, but I received a "device not found" error. Maybe he cannot see himself...
我在"Android开发选项"中搜索任何合理的选项,并启用了一切似乎与Wifi相关的功能.但是没有任何帮助.
I search for any reasonable option in "Android Development Options" and enabled everything seemed to have relation with Wifi. But nothing helped.
我搜索StackOverflow,但之前发现的所有答案都涉及通过USB电缆连接.我是否可以完全不需要电缆来进行此连接?
I search StackOverflow, but all answers I found involving connect via USB cable before. Is there I way to do this connection without the need of a cable at all?
一些信息: 我的Nexus 4没有扎根. android版本是5.1.1.
Some info: My Nexus 4 isn't rooted. The android version is 5.1.1.
推荐答案
存在相同的问题,但是我使用的Macbook Pro(2016)仅具有USB-c,我在家里忘记了适配器.
Had same issue, however I'm using Macbook Pro (2016) which has USB-c only and I forgot my adapter at home.
由于根本无法在开发计算机上运行adb,因此我找到了另一种方法.
Since unable to run adb at all on my development machine, I found a different approach.
使用USB电缆将电话连接到另一台计算机(在同一WiFi中),然后从那里启用运行adb tcpip.
Connecting phone with USB cable to another computer (in same WiFi) and enable run adb tcpip from there.
主机:仅使用USB-C连接器即可进行开发的计算机
Master-machine : computer where development goes on, with only USB-C connectors
从机:另一台具有USB和相同WiFi的计算机
Slave-machine: another computer with USB and in same WiFi
步骤:
- 将电话连接到另一台计算机(从机)
- 从那里运行
adb usb && adb tcpip 5555
-
在主机上
- Connect the phone to a different computer (slave-machine)
- Run
adb usb && adb tcpip 5555
from there On master machine
deko$: adb devices
List of devices attached
deko$: adb connect 10.0.20.153:5555
connected to 10.0.20.153:5555
现在,Android Studio或Xamarin可以在手机上安装并运行应用了
Now Android Studio or Xamarin can install and run app on the phone
边注:
Sidenote:
我还测试了从电话到主机的蓝牙网络共享,并成功连接到电话. Android Studio和Xamarin都可以正常工作,但是从Xamarin进行上传的过程耗时很长.但这有效.
I also tested Bluetooth tethering from the Phone to Master-machine and successfully connected to phone. Both Android Studio and Xamarin worked well, however the upload process, from Xamarin was taking long time. But it works.
这篇关于完全没有USB电缆的Adb over Wireless,适用于无根电话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!