This blog is to describe how to capture the log on the Android device and how to configure the wireless interface instead of using the USB cable connection.
Also, I would like to show how to mirror the Android screen on the Windows Host by using the command line freely.
What is the logcat in Android?
Logcat is a command-line tool that dumps a log of system messages, including stack traces when the device throws an error and messages that you have written from your app with the Log class.
Logcat is very useful to do the debugging particular when the app is released into the market. The support engineers analyze the bug logs to resolve the issue. There are for different types of Logs available in the Android Eco-System.
- Application Logs
- Android System Logs
- Event Logs
- Radio Logs.
The above four different log buffers in the Linux kernel, which provide logging for different parts of the system. Access to the different buffers is via device nodes in the file system, in /dev/log.
In most cases, ADB is used over a USB connection to send and execute commands from your computer to your Android device. However, it works over a wireless connection as well. If you can use the ADB wirelessly with your Android device, it means that you don’t need any mess of cables and you still connect other USB devices such as USB disk, USB reader with android for debugging.
Use ADB Wirelessly For Non-rooted Android Devices
Android 11 and higher support deploying and debugging your app wirelessly from your workstation using Android Debug Bridge (adb). For example, you can deploy your debuggable app to multiple remote devices without physically connecting your device via USB. This eliminates the need to deal with common USB connection issues, such as driver installation.
Before you begin using wireless debugging, you must complete the following steps:
- Ensure that your workstation and device are connected to the same wireless network.
- Ensure that your device is running Android 9 or higher.
It will require only few steps to get this done.
Step 1 : Connect your adb host computer and your android phone to same network
Make sure that your android phone and your host computer are connected on the same network then you will be able to debug your app.
STEP 2: Connect the device to the host computer with a USB cable.
STEP 3: Enable the Developer options on android
Launch the Settings app on your Android device, tap on Developer options, and enable the option that says USB debugging. This is the option that lets you connect your computer to your Android over ADB.
On Android 4.2 and higher, the Developer options screen is hidden by default. To make it visible, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options at the bottom.
STEP 4: Download the adb (scrcpy package) from https://github.com/Genymobile/scrcpy
It supports the mirror android screen on the PC / Linux / MacOS. Inside the package of scrcopy, it contains the ADB tool (adb.exe)
This application provides display and control of Android devices connected via USB (or over TCP/IP). It does not require any root access. It works on GNU/Linux, Windows and macOS.
STEP 5: Check whether your device is properly connected
Step 6 : Set the target device to listen for a TCP/IP connection on port 5555
adb tcpip 5555
STEP 7 : Find the IP address of the Android device.
If you are using Windows 10 / 11, you can enable the Mobile hotspot as the router. And then the target Android device is connected to hotspot router in order to connect under same router network.
you can find the IP address at Settings > Wi-Fi Settings > Advanced > IP address.
STEP 8 : Connect to the device by its IP address.
adb connect device_ip_address
STEP 9 : Remove the USB cable
Remove the USB cable and you should be connected to your device. If you don’t see it in
adb devices then just reconnect using the previous steps command.
STEP 10 : Confirm that your host computer is connected to the target device
$ adb devices
List of devices attached
Mirror Android Screen on the PC / Linux / MacOS
Plug an Android device, and execute:
Plug an Windows Host, and execute:
Run the scrcopy.exe as below
If you like this blog, may I get the support from you to maintain this blog?
Your appreciation would be very helpful.
Your donation is the best method to appreciate on my works. Thank You.