Categories
Mobile Programming

How to fix the “Android emulator crashes when I take a screenshot” bug

The Android emulator for the current stable version of Android Studio (“Arctic Fox” 2020.3.1 Patch 3, built on September 30, 2021) has a bug that could be a problem if you write articles or document apps: When you press the “screenshot” button (the one with the camera icon), it quietly crashes. The application shuts down without an error message, and it doesn’t save a screenshot.

I rely on the emulator’s “take a screenshot” feature in my developer advocate job, so this was a big problem for me. Luckily, I found a fix.

This bug will eventually get fixed, but until that time, the workaround is to update the emulator to the version in the “Canary” build, Android Studio’s leading-edge preview. You don’t have to download the Canary build for all of Android Studio — just the emulator. I’ll show you how to do it in the following steps.

Step 1: Temporarily change Android Studio’s update channel to “Canary”.

Tap to view at full size.

Open Android’s Preferences window, expand the Appearance & Behavior menu, and then its System Settings sub-menu, then select the Updates item.

In the Automatically check updates for menu, select Canary Channel, then click the Apply button.

Android Studio is now set up to get its updates from the Canary Channel, which is where the pre-beta versions of upcoming versions live.

Step 2. Download the Canary Channel version of the emulator.

Tap to view at full size.

Select Android SDK from the left menu, then click the SDK Tools tap in the right pane.

Check the Android Emulator checkbox in the list of SDK tools, and then click the Apply button.

You’ll be presented with this dialog box:

Tap to view at full size.

Click OK and let Android Studio do its thing:

Tap to view at full size.

When the process is complete, you’ll see that you have the 31.1.3 version of the emulator:

Tap to view at full size.

At this point, you’ll have a version of the Android emulator that doesn’t crash when you take a screenshot.

Step 3: Change Android Studio’s update channel back to “Stable”.

Tap to view at full size.

You can stay on the Canary channel if you like living on the bleeding edge, but most of us are better off with Android Studio getting its updates from the Stable channel.

Go back to the Updates screen, select Stable Channel, and click the Apply button and then the OK button.