This article will be helpful for Mobile Apps tester and developer to install and capture logs in Android App. I have tried to explain, how a tester/developer can install Android App and capture Crash/Error log for app crash. Log is helpful for the developer to debug and fixing the bugs.
During testing/using of an Android app, App gets crashed or stopped working due to some unexpected causes. When an app crashes, app’s process gets terminate and displays a dialog with message i.e.: “Unfortunately App has stopped”. A Log capture tool captures all process and creates a history known as Log which is required for the developer to debug the code and find out the actual cause of crash/error. Many Android App Development Company relies upon using an integrated development environment for all Android applications and Android Studio always top the list of preferred tools for developers.
How to Install the .apk file on Android Devices:
Android .apk installation: There are 2 common ways to install a .apk file on Android Device
1. Best way to install Android app is to install it through Diawi or Hockey app or from Play Store(for alpha, beta build). Many time what we observed that build is working fine if we install it locally from a machine, but after sharing it on some channel, we start getting strange errors, like feature working on local build is not working on released build. To avoid those challenges, I would suggest that tester need to download the build from staging platforms like Diawi or Hockey app or from Play Store(for alpha, beta build).
2. Install .apk on Android device using ADB:
To install a .apk file using ADB in the Android device we required adb driver in our PC/Laptop. If adb driver is not installed in PC, first we need to install adb driver. We can download adb driver form: http://adbdriver.com/downloads/
After installing the ADB driver we need to perform some steps to install apk file in our Android device.
• Open adb folder on PC
• Put the .apk file in adb folder
• Connect Device with PC using the USB cable
• Hold Shift Key+Right click in adb folder
• Select ‘Open Command Window here’ option on the dialog box
• Now type ‘adb devices’ on command prompt
• Allow USB debugging on the Mobile device
• Type ‘adb install filename.apk’ (for the device)
• Type ‘adb install –s filename.apk’ (for the emulator)
• After installing the .akp file ‘Success’ message will display on Command prompt
How to Capture Log for Android App:
During testing of the app, sometimes App is being crashed or showing some unexpected errors and the tester/user is blocked to test/use the app. So, we required to capture device Log to know the exact problem. There are many ways to capture Log for Android. We can capture log using ADB Command, Android SDK, Android Studio and aLogcat tools.
Capture Android device log using ADB command: To capture device log we need to perform some steps.
• Connect the device with PC
• Enable device Developer mode (Go to Settings > About Phone > Build Number > tap on build number 4-5 times > Turn USB debugging in Developer Mode)
• Open Command Prompt
• Write “adb devices” command on command prompt
• After showing a connected device on the command prompt, write ”Adb logcat” to capture log
• Perform activity on the device to reproduce the crash/error
• After reproducing the bug, stop log capturing process pressing the “Ctrl+C”
• Write command “adb logcat>log path/file name.txt” to save Log file.
Capture Android device log using Android SDK (monitor.bat tool):
To capture device log with Android SDK, Android SDK tool should be installed on PC. We need to perform below-mentioned steps to capture log with Android SDK tool.
• Connect the device with PC.
• Go to Android SDK > Tools and double-click on monitor.bat file.
• After clicking on monitor.bat file, ‘Android Debug Monitor’ tool gets open.
• Then select the device under Device section.
• Click on Logcat tab display with Console.
• Click on the Clear icon to clear the previous log.
• Perform steps to reproduce the bug on the device.
• After replicating the bug on the device, click on ‘Save’ button on ‘Android Debug Monitor’
• Select the folder path and Save file.
Capture Android device log using Android Studio:
To capture device log we need to perform some steps.
• Enable device Developer mode (Go to Settings > About Phone > Build Number > tap on build number 4-5 times >
Turn USB debugging in Developer Mode)
• Connect Device with PC
• Launch Android Studio
• Click on Run button
• Choose your device
• Click on OK button
• Click on ‘Android Monitor’ option
• Click on Logcat tab
• Perform Activity on App in device
• Select and copy captured log under Logcat tab
• Open a .txt file, paste copied log and save file
Capture log using the aLogcat tool on Android device:
aLogcat tool is developed for the Android device. The aLogcat tool is an Android app, it is used to capture Crash or error log. So, we need to install aLogcat tool from google play store on our device. To capture log with aLogcat we need to perform some steps.
• Run aLogcat tool on the device
• Minimize the aLogcat tool
• Launch testing app
• Perform the activity and replicate the Crash/Error bug on testing app
• Maximize the aLogcat tool and quit
• Go to device memory >aLogcat folder
• Save Logcat.txt file
Get your web and mobile apps integrated with the agile quality assurance testing services and solutions with QSS Technosoft. Backed up by a qualified testing team, QSS is a leading name in offering reliable quality assurance and testing services in India. So, don’t look further & contact us for an uninterrupted and seamless experience through glitch-free web & mobile apps!
Ragendra Singh is a QA Engineer, currently working with QSS Technosoft Pvt Ltd. He has completed his Master degree in Information Technology.