In Mobile App Development
6
136 views

More and more people are using smartphones today, hooked on Android, IOS, and Windows commonly. This calls for advanced features, applications in smartphones like interesting games, banking, media, chat messenger and much more. Life has become simpler with the advent of new mobile technology. Using desktop or laptops to access applications can now be done over mobile, which helps us save time and efforts.

Realising this advantage, the IT organizations have now drifted towards developing the mobile versions(IOS, Windows and Android Applications) of the web applications.

I have a question for the mobile testers, did you ever face error like- ‘Unfortunately application(name) stopped?’ as displayed in the below figure.

crash-mobile-application

What Does This Error Mean?

This error means, crash in the mobile application (IOS, Windows and Android Applications). The whole application has stopped working.

When Do You Get This Error?

If you are a Mobile tester, this type of error will show up when,

  • Application is in developing phase

  • The application is being used by users or on server crashes.

Having said this, sometimes “Crash” error occurs randomly. For instance, if you are testing mobile application and suddenly you faced “Unfortunately application(name) stopped and you will try to reproduce the same error but you fail.

We are not sure, as an Android application will not get a crash in the production environment since you were not able to take the logs of the random crash.

Don’t worry, you can easily get the logs of android applications crashes and show to a developer so that he can easily fix the crashes on time and the user will not be able to face the crash error in the production environment.

Here is an easy way to capture the crash logs of Android Applications…

There are a lot of ways to take the crash logs of Android applications. I would like to suggest you to use ADB to get the crash logs by using Command Prompt. I will show you the working of ADB step by step.

What is ADB?

Before going into detail, let’s have a quick introduction on ADB. ADB is an Android Debugging Bridge through which you can communicate with a device (Device may be Emulator or a real connected device). The ADB command provides multiple facilities like installing and debugging apps and you can also use it to run a command on an android device. ADB is basically a client-server program.

ADB allows you to remold your device (or devices software) via a PC commands line. In this article, we will run the commands to get the crash logs.

Prerequisite for ADB:

A) Java:

Java is mandatory before starting the ADB. If updated Java is already available in your system, you don’t need to install Java. you can check, Java is available or not in your system as given in the below figure:

Open the Command Prompt-> Type “Java -version” command->Enter

 

If Java is not present in your system, you can download it from the below link:

https://java.com/en/download/

B) Android SDK Platform-Tools:

Being a tester, you need to download only Android SDK Platform Tools instead of complete ADT bundle. You can download it from the below link:

https://developer.android.com/studio/releases/platform-tools.html

Download and Keep the folder in any drive.

Need to set the Environment Variables for Java and Android SDK:

C) Environment Variables for Java:

You need to add environment variable for Java when Java is not accessible in your system. You can refer below link to add:

https://stackoverflow.com/questions/1672281/environment-variables-for-java-a

D) Environment Variables for Android SDK:

You can add environment variables by following steps which are available in the below link:

http://www.software-testing-tutorials-automation.com/2015/09/set-androidhome-and-path-environment.html

How Will You Use ADB?

Now that you have the environment ready to use the ADB, get ready to use ADB to catch the crash logs of the android application whenever you face a crash error in your device. For average users, the only time you will require to use ADB is when you have step-by-step instructions.

A) Enable “USB Debugging” Option of Android Devices:

To use ADB with a device connected via USB, you must enable USB debugging option in the device system settings, under Developer options.

On Android 4.2 and higher, the Developer options screen is invisible by default. To make it visible, go to Settings > About phone and tap Build number seven times. You need to go back to the previous screen to find Developer options at the bottom of the screen.

B) Connect your Device:

Now connect your android device or Emulator devices with the host computer via USB cable.

C) Access Android-SDK Folder:

1. Open the Command Prompt.

2. The most important thing to know how to access your ADB folder via commands. This is done with the cd (change directory) command. So if (on Windows) your SDK folder is called android-SDK and it’s in your root (c:) directory or you can keep “android-SDK” folder in any other directory like D, E and more.

 

I have given the name of “android-SDK” folder to “Platform-tools”.=So you would type the following commands to get into the platform-tools folder:

C:\Users\(Username)> cd Platforms-tools

List of connected devices:

C:\Users\(Username)\Platforms-tools> adb devices

If everything is set up properly, you will see a list of devices attached as shown in the below figure:

access-android-sdk-folder

 

Crash Logs:

Now you require to type the command “adb logcat AndroidRuntime:E *:S” to get the crash logs of the android applications. You can see crash logs in the below image:

crash-logs

In the above figure, highlighted content is exhibited “Command to take crash” and crash logs. So you can report the error to a developer to get it fixed. This is the main step of this article.

Key Advantage of ADB:

Though there are many advantages, I am going to explain one which can be used to install the android applications. It will be good for you if you will install the “.apk” file via ADB rather than doing manually. So you need to follow below steps:

1. Keep the “.Apk” file in any folder on the host computer.

2. Connect the Android device to which you want to install the “.apk” file with the host computer.

3. Open the command prompt, type command “Adb Install” and give a path to the folder where “.Apk” file is available in the folder as shown in the below figure:

key-advantage-of-adb

 

The high pointed content “Success” in the above figure shows installation status of an application.

Is ADB best to get the crash logs of Android Applications?

Yes, ADB is really the best tool for both developers and testers which is a great thing in itself. ADB can be used to install and debug the android applications. It helps to automate the applications.

In this article, we have learned how to get the crash logs of Android applications only. If you want to learn how it will use in Automation Testing. So you can learn from the below link:

http://toolsqa.com/mobile-automation/appium/appium-tutorial/

Do you think, Is this easy way to get the crash logs of android applications??? Let your opinions matter in the comments section below…

Recent Posts
  • Nikita Aulakh

    Thanks a lot.

  • Nikita Aulakh

    Thanks

  • shubhangi shukla

    Thanks for posting this blog!! its really very helpful!!

    • Nikita Aulakh

      My Pleasure.

  • B Uma Sankar

    Thanks for the valuable information… expecting more like this.

    • Nikita Aulakh

      Thanks.

We Are Here to Help!
Name:
Phone:
Email:
Country:
Message:
Captcha:
 

Start typing and press Enter to search