Android OS is an open and innovative platform to allow developers to be free and creative. There are many apps to run on the Android OS, but some apps can be buggy or nonworking. Repeated cashing, stopping, and exhibiting repeated error messages like “App is not responding” can create problems. When the app crashes, the OS keeps the record in the logs that can be used to inspect the information about the app crash events, factors causing the app to crash, etc. This article will show you how to debug the Android app using the logs.
Before starting, you should have the following things with you.
Now carefully follow the following steps:
You need to enable it from the Android device you will connect to the PC.
This method includes the Android Debug Bridge (ADB). Please note that your Android Studio should have an adb.exe file on your PC.
You can check C:\Users\Username\AppData\Local\Android\Sdk\platform-tools, and if adb.exe is there, you are okay; otherwise, check here to learn the ADB installation process. Follow the steps below:
P.S. Google has enabled it to run ADB and Fastboot without installing Android Studio.
In this case, you can prefer the following options.
If you have Android 11 or higher, you can debug wirelessly without connecting a physical device to the PC.
In this case, you can follow the following steps:
Open Android Studio and click on the “Pair Devices Using Wi-Fi” option from the run configurations menu, as shown below.
All the above steps configure all the necessary components for debugging the Android apps via USB connection or wirelessly. You need to have the basic knowledge to read the logs. Here you can capture the bug reports by using ADB as follows:
1. If you have connected only one device to the PC, enter the following command.
$ adb bugreport E:\Reports\MyBugReports
2. You need to specify the path. Otherwise, it will be saved to the local directory of your PC. By default, bug reports are in the /bugreports and you can enter the following command to view them.
$ adb shell ls /bugreports/
bugreport-foo-bar.xxx.YYYY-MM-DD-HH-MM-SS-dumpstate_log-yyy.txt
bugreport-foo-bar.xxx.YYYY-MM-DD-HH-MM-SS.zip
Dumpstate-stats.txt
$ adb pull /bugreports/bugreport-foo-bar.xxx.YYYY-MM-DD-HH-MM-SS.zip
The ZIP file contains bugreport-BUILD_ID-DATE.txt file, which is the most important to inspect the error. In addition, the bug reports consist of the following:
You can also capture the system trace using the Systrace tool, and the dumpstate tool copies the file to store in the FS folder, which can be very useful for debugging the app.
Here are a few myths about app testing that you should not believe.
1. Google already verifies mobile apps: This is the most notable myth because Google provides the essential frameworks and tools for developing safe apps, so they do not deeply check the apps’ codes or bugs before making them online on PlayStore. So, developers should be responsible for any security breaches or persistent bugs in their apps.
2. Testing an app on a few devices is enough: Some developers believe their apps run all devices after testing on a limited number of devices, but there are wide ranges of devices having their own hardware or software configurations so that the apps may exhibit some bugs. So the app testing should be performed on a large scale before propagating them on the internet.
3. Emulators are the perfect options for testing the apps: It is another myth. A good emulator allows developers or app testers to test apps for the initial stage of the app’s development, which means testing apps on emulators may not guarantee the apps’ performance on real-world devices.
For more detailed information about reading the bug reports from the logs, you can keep learning from this great resource. Learning new things will never be too late, so get started today.
The codes written for the android apps should execute correctly for smooth functioning. Sometimes, the apps may exhibit bugs that need to be fixed using the proper debugging tools. Nowadays, many platforms claim that they debug the app remotely, but some can be malicious to steal sensitive data, so you have to be very careful.
Enabling the USB Debugging option all the time can be risky if you connect your device to a public USB charging station or some infected PC. Try to adopt all the safety measures first.
If you’re a newcomer to learning mobile debugging, you can find great online resources to boost your skill. Perfectly working apps are desirable for most businesses. Hence, they try to release bug-free apps to the users, and they often run bounties or cash prizes for detecting the bugs in their apps, so if you learn the debugging techniques from the beginning, your career is bright in this field.
Good Luck!