As the title, today I will share a fairly old but great tool to help mobile developers to work more easily (a bit). Its name is Android Debug Bridge (or more familiar name is adb ), listen to this, you guys will click “oh my god !!!”, this is as old as the earth, whoever makes mobile without knowing this ?? “.
For those who do not know what adb is, adb is a tool to help laptop / pc communicate with smartphones. Communicate according to that command, not the file transfer type ). You can refer to here .
Yes, everyone knows what adb is, but not everyone uses its full power. Especially when Android Studio 3 and its ADV (virtual machine) sect were born, everyone seemed to forget the presence of this legend. . Today, I will share a little tip to help people be able to love from the beginning.
So what are its advantages?
Advantage 1: Support connecting smartphone to laptop / pc
As the name implies, adb is a form of bridge, which allows a laptop / pc to order our android device to function as we wish. The most typical example is that instead of running the virtual machine -> consuming ram, consuming gpu / cpu , we can completely connect the phone to the laptop via a cable to program. Thus the laptop will be lighter load, less angry, more importantly the extremely fast loading speed . This is really useful for those of you who like a thin and light laptop (like my asus ux410) but can still code everything in the world. In addition, running on a real machine will help me to have a more real experience than running on a virtual machine (those who do flutter will probably understand this problem). The only downside of this approach is that we will have to plug the long clip from phone to laptop.
Pros 2: Still is support connection: v
This is the focus that I want to mention (above is just a slash: v).
ADB has a server-client interface over TCP . This means, we can turn the smartphone into a server to receive commands from the client (laptop) via a wifi connection. Simply put, instead of plugging in the cable, now you only need to generate wifi or connect to a local wifi department to be able to code: v.
Note: Your phone and computer must be connected to the same wifi network
To install the first time you open cmd or shell, type:
If the cmd shows something similar to this (picture below), that means your computer has adb installed before. Usually when installing Android Studio has adb already installed. Next, the first setup is painful. You plug the cable into the laptop and smartphone to recognize each other, then open the command prompt and type:
adb tcpip 5555
This is to open the port, meaning that the computer that the phone will communicate with via this 5555 port, you can change any number as you like.
Next, on the phone access to wifi -> see information -> write down the IP Address and enter the command:
adb connect <ip address>:5555
Replace <ip address> with the IP you just wrote down.
Alright !! so now you can remove the cap and run the test code. After the connection is successful, the next time, the device will automatically recognize itself to connect, we just sit and enjoy. To turn off this mode (to use traditional cap), enter the command:
This way you can connect not only one but many devices at the same time without the wires or virtual machines at all. ). Check out more here .