This is also an implementation principle of mobile phone screen to mobile phone

Do you encounter any of the following problems during actual development:

  • Development always need to connect the data line, always inconvenient
  • Computer output current is not enough, one to the development of the experience of the mobile phone fast charge

Where is the ADB

$sdk/platform-tools
Copy the code

Open ADB remote debugging

The device must be on the same LAN as the PC

Have the root permission on the mobile phone?

Run this command on a mobile phone

setprop service.adb.tcp.port 5555
stop adbd
start adbd
Copy the code

Then execute it on the PC

Adb Connect device IP :5555Copy the code

The mobile phone does not have root permission

Use the cable to connect the computer first

PC input:

adb tcpip 5555
Copy the code

Unplug data cable

PC input:

Adb Connect device IP :5555Copy the code

ADB Port Forwarding

adb forward tcp:5005 tcp:5005
All 5005 port traffic data on PC will be redirected to 5005 on mobile
Copy the code

After this command is executed, create a socket on the phone waiting for port 5005. We can use the PC to connect to 127.0.0.1:5005 to communicate with the socket on the phone

What is Fastboot for?

The Fastboot tool requires the device to start up in Fastboot mode, usually with the volume-plus power button long pressed to wirelessly brush your Android device

Is that fancy?

We cross-compile adb/ Fastboot to our arm64 device. It doesn’t matter if it doesn’t compile, let’s use someone else’s code

adb-ndk

As follows:

What that means is that we can use one device to do the same things that a PC can do to a device

Mobile phone can’t debug software, what’s the use

  • You can uninstall the APP that deletes other devices on the LAN
  • Manage files on other devices
  • Brush mobile phone to mobile phone through OTG data line (feasible, experiment passed)
  • Forward the port of the other device to this device (then connect the socket of the other device, cast screen, etc.)

Debug devices across lans

This is just an idea

Intranet penetration tools (such as FRP) are required, and a server is required

Use the ARM64 FRP as usual to map the DEVICE’s ADB remote listening port to the specified port on the server

It is then executed on the PC

Adb Connect server IP: the port you specifiedCopy the code

In this way, we can debug any device on the extranet and remotely control the device on the extranet through tools such as SCRCPY