android-emulatorandroid-studio-3.0android-studio-electric-eel

Why Does emulator under Android Studio Electric Eel now run twice when targeting same Android version & start app in both copies?


Background

I'm attempting to run two copies of Android Studio Electric Eel (version details are at bottom of this post) running two different projects.

I'm targeting a Pixel 6 API 31 with both apps (each app in its own Android Studio window).

The Problem

In the past, when I would target the same device for both projects then the app would start on the same emulator instance.
Now, the app starts a new emulator running the same API (31) and runs the app on both emualtors:

Here's a snapshot of two instances of the same emulator running (no worries all those keys are testing keys and do not need to be protected):

two instances of the emulator

Notice the Emulator Shows They Are the Same

At the top of the emulator you can see that they are running the same version of the API 31.

Why does this happen now?

I've run two Android Studio Windows in the past and if you target the same emulator then a new emulator window was not opened. Now it seems that Electric Eel opens a new emulator window but runs the app on both at the same time.

This seems like a bug.

When I click Stop in the Android Studio window where I started the app, then the app closes on both emulators.

Is There a New Configuration?

Is there a new configuration setting that I don't know about, that tells it to run one instance?

Additional Info : Using the Emulator (button)

If I go to one of the Android Studio windows and click the Emulator button along the bottom right side (shown in next image) then only one emulator responds -- let's call this one Emulator 1.

If I go the other copy of AndroidStudio which is running and click that same button, only one emulator responds -- let's call this one Emulator 2.

So, AS knows that the emulators are different but then starts the app on both, Why?!

emulator sidebar button

Submitted As a Bug

Now that I worked through this I decided that it must be a bug and I submitted it to the Android Studio team. https://issuetracker.google.com/issues/277630896

Android Studio Version Details

Android Studio Electric Eel | 2022.1.1 Patch 2 Build

#AI-221.6008.13.2211.9619390, built on February 16, 2023 Runtime version: 11.0.15+0-b2043.56-8887301 amd64 VM: OpenJDK 64-Bit Server VM

by JetBrains s.r.o. Linux 5.19.0-38-generic GC: G1 Young Generation,

G1 Old Generation Memory: 2048M Cores: 12 Registry:

external.system.auto.import.disabled=true

ide.text.editor.with.preview.show.floating.toolbar=false

Current Desktop: ubuntu:GNOME


Solution

  • There is only one running emulator, but it is shown twice in Studio. Each project has its own window and therefore its own Emulator tool window. Each Emulator tool window is showing all running emulators because emulators are not tied to projects.