See forum post Any way to view Android screen remotely without root?
(查看论坛帖子是否可以无root权限远程查看Android屏幕?)
- Post #9 . (-发布#9 。)
- Connect the device via USB and make sure debugging is working;
(通过USB连接设备并确保调试正常;)
-
adb tcpip 5555
. (adb tcpip 5555
。)
This makes the device to start listening for connections on port 5555; (这使设备开始侦听端口5555上的连接。)
- Look up the device IP address with
adb shell netcfg
or adb shell ifconfig
with 6.0 and higher; (使用6.0或更高版本的adb shell netcfg
或adb shell ifconfig
查找设备IP地址;)
- You can disconnect the USB now;
(您可以立即断开USB连接。)
-
adb connect <DEVICE_IP_ADDRESS>:5555
. (adb connect <DEVICE_IP_ADDRESS>:5555
。)
This connects to the server we set up on the device on step 2; (这将连接到我们在步骤2上在设备上设置的服务器。)
- Now you have a device over the network with which you can debug as usual.
(现在,您可以通过网络使用设备进行调试了。)
To switch the server back to the USB mode, run adb usb
, which will put the server on your phone back to the USB mode.
(要将服务器切换回USB模式,请运行adb usb
,这会将手机上的服务器恢复为USB模式。)
If you have more than one device, you can specify the device with the -s
option: adb -s <DEVICE_IP_ADDRESS>:5555 usb
. (如果有多个设备,则可以使用-s
选项指定设备: adb -s <DEVICE_IP_ADDRESS>:5555 usb
。)
No root required!
(无需root!)
To find the IP address of the device: run adb shell
and then netcfg
.
(要查找设备的IP地址:运行adb shell
,然后运行netcfg
。)
You'll see it there. (您会在那看到它。)
To find the IP address while using OSX run the command adb shell ip route
. (要在使用OSX时查找IP地址,请运行命令adb shell ip route
。)
WARNING : leaving the option enabled is dangerous, anyone in your network can connect to your device in debug, even if you are in data network.
(警告 :启用该选项很危险,即使您处于数据网络中,网络中的任何人都可以通过调试连接到设备。)
Do it only when connected to a trusted Wi-Fi and remember to disconnect it when done! (仅在连接到受信任的Wi-Fi时执行此操作,并记住在完成连接后将其断开连接!)
@Sergei suggested that line 2 should be modified, commenting: "-d option needed to connect to the USB device when the other connection persists (for example, emulator connected or other Wi-Fi device)".
(@Sergei建议修改第2行,注释:“-d选项需要在其他连接持续存在时连接到USB设备(例如,仿真器连接或其他Wi-Fi设备)”。)
This information may prove valuable to future readers, but I rolled-back to the original version that had received 178 upvotes.
(该信息可能对将来的读者有价值,但是我回滚到最初的版本,该版本已经获得178次投票。)
On some device you can do the same thing even if you do not have an USB cable :
(在某些设备上 ,即使没有USB电缆,您也可以做同样的事情:)
- Enable ADB over network in developer setting
(在开发人员设置中通过网络启用ADB) It should show the IP address
(它应该显示IP地址)
-
adb connect <DEVICE_IP_ADDRESS>:5555
- Disable the setting when done
(完成后禁用设置)
Using Android Studio there is a plugin allowing you to connect USB Debugging without the need of using any ADB command from a terminal.
(使用Android Studio,有一个插件可让您连接USB调试,而无需使用任何来自终端的ADB命令。)