How to troubleshoot app issues on Android Emulators

GuanZhang
5 min readApr 13, 2021

--

Introduction

Android Emulators are great for playing mobile games on your computer, the following are just a few of the main reasons:

  • The game is not supported on your mobile device
  • The game uses too much battery so you need to constantly charge it during long play times
  • You want to be able to play the game on a bigger screen
  • You want to be able to use your keyboard/mouse/controller to play the game
  • You want to be able to run scripts/macros to automate tedious in-game tasks

However, they can be finicky because not all games are supported so the emulator developers are constantly playing cat and mouse with the game developers to fix bugs that crop up when new updates are released, since game devs typically would not be testing their code on Android Emulators as they already have their hands full testing on all sorts of mobile devices.

You go to any popular emulator communities and the thing that is constantly being asked is “Game X does not run on emulator Y, how do you get it to work?”. Well those are not always trivial questions to answer, but with some Android debugging tools you will be able to get closer to the root cause of the issue. It may not necessarily help you solve the problem, but at least you will get a better understanding of what’s going on and hopefully the emulator devs can offer you a fix with the information you provided. Some of the common issues are:

  • Black/blue screen
  • Instant crash upon launching app
  • Random crash/freeze during gameplay

How to troubleshoot

Whether you are on Windows, Mac or Linux, the tool is the same — you need ADB or Android Debug Bridge. Some emulators come with this tool in its distribution but it is also fairly easy to download from Google, since it’s an official tool that’s part of the Android SDK.

Before we download the tool, let’s make sure your emulator has ADB enabled. For some systems such as MuMu App Player, ADB is enabled by default. Others, such as BlueStacks for Mac it’s under Preferences > Preferences, just check the box “Enable Android Debug Bridge (ADB)”.

If you cannot find the setting and the option doesn’t seem enabled, you may be able to enable it the traditional way via Developer Options under Android Settings: https://www.samsung.com/uk/support/mobile-devices/how-do-i-turn-on-the-developer-options-menu-on-my-samsung-galaxy-device/.

Now we can go to this URL and grab the SDK for your platform of choice: https://developer.android.com/studio/releases/platform-tools. Extract the ZIP file and start up a command prompt and navigate to the folder where the adb binary resides. For Windows this will be like the CMD program or Terminal on macOS. The following are some common operations you will perform using adb. For additional information you can invoke the help menu by running adb --help

adb devices

This command lists all devices that your computer is connected to, it can be any Android system like emulators or even physical Android devices connected to your computer via USB cable.

adb connect

Use this command to connect to the device, you will need to pass the device’s hostname/port.

adb logcat

This invokes the logcat command via adb and will be the main command we’ll be using for troubleshooting. If you simply run the command as is it will dump a lot of logs, so you’ll want to either pipe the output to a log file or try to filter using the command line options or other tools such as grep, however how to do this is outside the scope of this article. A simple Google search should provide you with lots of options.

Now to put everything together, let’s try to look at the logs of a running emulator. Start up the emulator and then execute the following commands:

First check to see if we already have any connected devices:

adb devices

If not, then let’s connect to the running emulator

adb connect localhost:5555

Sometimes the emulator is automatically connected as emulator-5554 so if you see that is already connected you can skip the above step. Not all emulators follow the port convention so if port 5555 doesn’t work then do a Google search for what the number should be for your emulator or try to look in VirtualBox files. If you have multiple instances of the emulator running you typically would increment the port number by 1 to get to the next instance.

If you have multiple devices connected you will need to specify the device you want to execute commands on by using the -s option, for example adb -s localhost:5555 logcat.

Now that’s a lot of messages, let’s try to filter it a bit to only show errors by using the *:E option after the logcat command:

It’s still showing a lot of messages but at least it’s manageable. Now let’s try to look at an example on how to troubleshoot an app that does not start.

The game Shin Sangoku Musou is known to not work on MuMu App Player for Mac, it just shows a blue screen:

Now let’s examine the logs to see why it’s not working. While the logcat command is running, startup the app in question and watch for any error messages popping up:

While we are not 100% certain this is the root cause of the issue, it’s quite likely these (EGL_BAD_ATTRIBUTE) errors are the culprit because EGL has to do with graphics context management and most of the time when games don’t start it has something to do with graphics rendering. While there isn’t much a user can do about these errors, at least we can forward these logs to the emulator devs for them to help troubleshoot the issue.

There you have it, now we are slightly less in the dark when it comes to apps not working on emulators. If you have any questions feel free to leave comments below or join the AndroidEmu Reddit or Discord server where we talk about all the different Android Emulators in the market and even Android-x86 for good measure.

For further reading on adb, check out this link: https://developer.android.com/studio/command-line/adb

--

--

GuanZhang
GuanZhang

Written by GuanZhang

Want to help build an Open Source Android Emulator (Win/Mac/Linux)? Join the AndroidEmu Discord and let's talk! https://discord.gg/mRpT4Qq

No responses yet