maestro icon indicating copy to clipboard operation
maestro copied to clipboard

Maestro 2.0.2 Cannot Detect ARM64 Android Emulators on Apple Silicon Mac

Open nautilytics opened this issue 4 months ago • 26 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues and didn't find mine.

Steps to reproduce

Environment Setup

  • Device: ARM64 Android Emulator (Pixel 6 API 30) on Apple Silicon Mac
  • OS: macOS 15.6 (Darwin Kernel Version 24.6.0)
  • Processor: arm64 (Apple Silicon)
  • Android Emulator: API 30, ARM64 architecture
  • App: React Native/Expo app

Detailed Reproduction Steps

  1. Start ARM64 Android Emulator:

    # Using Expo/React Native project
    npm run android
    # This successfully starts emulator-5554 with the app installed
    
  2. Verify ADB Connection:

    adb devices
    # Output: emulator-5554    device
    
    adb -s emulator-5554 shell pm list packages | grep <package_name>
    # Output: <package_name>
    
  3. Attempt to Run Maestro Test:

    ANDROID_SERIAL=emulator-5554 maestro test e2e/tests/Login/success.yaml
    
  4. Alternative Attempts:

    # Try with explicit device specification
    maestro --udid emulator-5554 test e2e/tests/Login/success.yaml
    
    # Try Maestro Studio
    maestro studio
    

Test Flow File

appId: ${MAESTRO_APP_ID}
name: Login Success Test Flow

env:
  E2E_SESSION_ID: app-${MAESTRO_APP_ID}-${MAESTRO_EAS_BUILD_ID}-login.success
  EMAIL: [email protected]
  PASSWORD: <password>
---

- tapOn:
    id: EmailInput
- inputText: ${EMAIL}

- tapOn:
    id: PasswordInput
- inputText: ${PASSWORD}

- tapOn: 
    text: Log in to your account
    label: Dismiss keyboard

Actual results

CLI Test Execution

Want to use 0 devices, which is not enough to run 1 shards. Missing 1 device(s).

Not enough devices connected (1) to run the requested number of shards (1).

Maestro Studio

When launching maestro studio, it shows:

No running devices found. Launch a device manually or select a number from the options below:

[1] Start or create a Maestro recommended device
[2] List existing devices
[3] Quit

Even when selecting option [2] to list devices, the running ARM64 emulator is not detected automatically.

Device Detection Commands

# This works fine
maestro --udid emulator-5554 test e2e/tests/Login/success.yaml
# Output: Device emulator-5554 was requested, but it is not connected.

# This also fails
maestro --udid 127.0.0.1:5555 test e2e/tests/Login/success.yaml  
# Output: Device 127.0.0.1:5555 was requested, but it is not connected.

Expected results

Maestro should:

  1. Automatically detect the running ARM64 Android emulator (emulator-5554)
  2. Successfully connect to the emulator when using ANDROID_SERIAL environment variable
  3. Execute test flows on the ARM64 emulator without device detection issues
  4. Show the emulator in Maestro Studio's device list

About app

  • Project Type: Closed source React Native/Expo application
  • Framework: React Native with Expo
  • Platform: Cross-platform (Android/iOS)
  • Target SDK: Android API 30
  • Architecture: ARM64 (Apple Silicon compatible)

The app builds and runs perfectly on the ARM64 emulator. All standard Android development tools (ADB, Android Studio, etc.) can connect and interact with the emulator without issues.

About environment

  • Machine: Apple Silicon Mac (arm64)
  • OS: macOS 15.6 (Darwin Kernel Version 24.6.0)
  • Java Version: OpenJDK 17.0.16 (Zulu17.60+17-CA)
  • Processor Architecture: arm64
  • Android SDK: Latest via Android Studio
  • Emulator: ARM64 Android Emulator (API 30)

Logs

Maestro Test Execution Logs
$ maestro --version
2.0.2

$ adb devices
List of devices attached
emulator-5554 device

$ adb -s emulator-5554 shell getprop sys.boot_completed
1

$ adb -s emulator-5554 shell pm list packages | grep <package_name>
package:<package_name>

$ ANDROID_SERIAL=emulator-5554 maestro test e2e/tests/Login/success.yaml
Want to use 0 devices, which is not enough to run 1 shards. Missing 1 device(s).

Not enough devices connected (1) to run the requested number of shards (1).

$ maestro --udid emulator-5554 test e2e/tests/Login/success.yaml
Device emulator-5554 was requested, but it is not connected.

$ maestro studio
No running devices found. Launch a device manually or select a number from the options below:

[1] Start or create a Maestro recommended device
[2] List existing devices
[3] Quit
Environment Information
$ uname -a
Darwin 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:40 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6041 arm64

$ java -version
openjdk version "17.0.16" 2025-07-15 LTS
OpenJDK Runtime Environment Zulu17.60+17-CA (build 17.0.16+8-LTS)
OpenJDK 64-Bit Server VM Zulu17.60+17-CA (build 17.0.16+8-LTS, mixed mode, sharing)

$ echo $ANDROID_HOME
~/Library/Android/sdk

$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home

Maestro version

2.0.2

How did you install Maestro?

install script (https://get.maestro.mobile.dev)

Anything else?

Key Observations

  1. ADB Works Perfectly: All standard Android development tools can connect to the ARM64 emulator without issues
  2. App Runs Successfully: The React Native app builds, installs, and runs perfectly on the ARM64 emulator
  3. Maestro Detection Failure: Maestro 2.0.2 specifically cannot detect ARM64 emulators on Apple Silicon Macs
  4. Architecture-Specific Issue: This appears to be related to ARM64 emulator detection on Apple Silicon hardware

Workarounds Attempted

  • Setting ANDROID_SERIAL environment variable
  • Using --udid flag with various device identifiers
  • Cleaning ADB state and restarting services
  • Trying TCP connections (127.0.0.1:5555)
  • Manual device selection in Maestro Studio

nautilytics avatar Sep 10 '25 13:09 nautilytics

So most of this shouldn't be necessary. The correct invocation, that you haven't listed, is just maestro test someFile.yaml. I wouldn't expect that to fix things though.

I wonder if how the device was launched could be at play. Do you get different results if you run

maestro start-device --platform=android --os-version=30
maestro studio

Fishbowler avatar Sep 10 '25 13:09 Fishbowler

When I run maestro start-device --platform=android --os-version=30 I get the below:

Using existing device Maestro_Pixel_6_API_30.

Launching emulator...

Unable to start device: Maestro_Pixel_6_API_30_1

The stack trace was:
maestro.device.DeviceError: Unable to start device: Maestro_Pixel_6_API_30_1
        at maestro.device.DeviceService.startDevice(DeviceService.kt:78)
        at maestro.device.DeviceService.startDevice$default(DeviceService.kt:23)
        at maestro.cli.command.StartDeviceCommand.call(StartDeviceCommand.kt:100)
        at maestro.cli.command.StartDeviceCommand.call(StartDeviceCommand.kt:23)
        at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
        at picocli.CommandLine.access$1300(CommandLine.java:145)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2358)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2352)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2314)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
        at picocli.CommandLine$RunLast.execute(CommandLine.java:2316)
        at maestro.cli.DisableAnsiMixin$Companion.executionStrategy(DisableAnsiMixin.kt:22)
        at picocli.CommandLine.execute(CommandLine.java:2078)
        at maestro.cli.AppKt.main(App.kt:158)

nautilytics avatar Sep 10 '25 13:09 nautilytics

Looks like we're getting closer to the real problem. It's not just about device detection.

Fishbowler avatar Sep 10 '25 14:09 Fishbowler

Was that after a long wait (~60s), or pretty quickly?

Fishbowler avatar Sep 10 '25 14:09 Fishbowler

Long wait (~60s)

nautilytics avatar Sep 10 '25 14:09 nautilytics

Try running your SDK Tools from Android Studio and check that the tools are up to date. This command uses the $ANDROID_HOME emulator binary.

Fishbowler avatar Sep 10 '25 14:09 Fishbowler

Oh, and obvious question to ask.... did the emulator launch?

Fishbowler avatar Sep 10 '25 14:09 Fishbowler

Android Studio SDK Tools

Image

And yes the emulator did launch, and quickly, but then it just sat there.

nautilytics avatar Sep 10 '25 14:09 nautilytics

I realise I forgot to circle back on this - I've tried a bunch of things on a couple of machines, and can't work out how to reproduce the issue. Did you ever work out what's causing this?

Fishbowler avatar Sep 26 '25 17:09 Fishbowler

I still haven't got it to work. It's strange, but it just won't identify the Android emulator I have running. I've changed to different versions of Maestro and still had no success. The other strange thing is that my machine was brand-new, so I got to start from scratch too. Is there any debugging I can try?

nautilytics avatar Sep 29 '25 23:09 nautilytics

Why don't we diff the entire set of things installed.

What's the emulator version running? You've got a screenshot of some build-tools. Which is the most recent? What about commandline-tools? Which version of Android Emulator? Which version of Android SDK Platform-Tools?

Fishbowler avatar Oct 12 '25 18:10 Fishbowler

1. What's the emulator version running? Android Emulator version 36.1.9

2. Which is the most recent build-tools from the screenshot? The most recent installed version is 36.1.0-rc1.

3. What about commandline-tools? Android SDK Command-line Tools version 19.0

4. Which version of Android Emulator? Android Emulator version 36.1.9

5. Which version of Android SDK Platform-Tools? Android SDK Platform-Tools version 36.0.0

Note: The project's build.gradle is configured to use buildToolsVersion 35.0.0, which is installed.

nautilytics avatar Oct 13 '25 14:10 nautilytics

Thanks! What's the version of Android running on the emulator?

Fishbowler avatar Oct 13 '25 20:10 Fishbowler

So it looks like the Android emulator I am using right now is the below (Android 15 w/ API version 35)

Image

nautilytics avatar Oct 13 '25 20:10 nautilytics

i have attached my Android physical device. and i'm having the exact same issue. i have Java 17 on macOS Tahoe . adb devices shows the device as active and authorised > "device"

maestro cli and maestro Studio can't connect and it can't see any device. the same device works well on a Ubuntu machine. but on MY apple Sillicon it doesn't!

Android_sdk latest and android emulators do boot fine but also can't be detected by maestro cli or Maestro studio desktop!

AhmedElhadidii avatar Nov 02 '25 17:11 AhmedElhadidii

I am also experiencing this issue on macOS with Apple Silicon (M2).

Environment:

macOS: Sequoia (M2)

Maestro version: 2.0.9

Android Studio installed with standard SDK path (~/Library/Android/sdk)

Emulator: Android Emulator - Pixel 9 API 35, visible via adb devices as emulator-5554

Symptoms:

adb devices correctly shows the emulator as a connected device.

Running maestro test results in:

Want to use 0 devices, which is not enough to run 1 shards. Missing 1 device(s). Not enough devices connected (1) to run the requested number of shards (1).

eyaly avatar Nov 09 '25 21:11 eyaly

Works with API 34 though?

Fishbowler avatar Nov 09 '25 22:11 Fishbowler

Thanks @Fishbowler for the quick response. I’m seeing the same issue with the Android Emulator Pixel 9, API 34 :-( I also tested with a real Android device connected to macOS and the problem is the same there. So both emulators and physical Android devices are affected. It does work correctly when using iOS simulators.

eyaly avatar Nov 09 '25 22:11 eyaly

A quick thought - I've hit some problems locally when other tools that are also ADB-interactive are involved (e.g. Vysor, Android Studio). Any chance this could be interfering with normal operations for you?

Fishbowler avatar Nov 10 '25 13:11 Fishbowler

Another one that's turned up in conversation on Slack - could another process be using a port that Maestro uses?

sudo lsof -i -P | grep LISTEN | grep :7001

Fishbowler avatar Nov 10 '25 15:11 Fishbowler

In my case, I tried closing Android Studio and leaving only the Android Emulator open, then tried again, but I still encountered the same issue. I also ran the command sudo lsof -i -P | grep LISTEN | grep :7001 and it returned no results, so it looks like no process is using port 7001.

eyaly avatar Nov 10 '25 15:11 eyaly

Apparently, an extension in Visual Studio Code was causing Maestro to fail to detect any device. It was a strange issue, but it fixed mine.

AhmedElhadidii avatar Nov 11 '25 20:11 AhmedElhadidii

@AhmedElhadidii - Do you know which Visual Studio Code extension caused this? In my case, Maestro does detect my iOS simulators. The only issue is with Android. :-(

eyaly avatar Nov 11 '25 20:11 eyaly

@AhmedElhadidii - Do you know which Visual Studio Code extension caused this? In my case, Maestro does detect my iOS simulators. The only issue is with Android. :-(

Couldn't pinpoint which one but you can force close vscode and extensions and verify if that's the reason on your end as well

AhmedElhadidii avatar Nov 12 '25 08:11 AhmedElhadidii

Had the same problem which was resolved by simply disconnecting any real devices from usb ports.

OlhaKorolova avatar Dec 03 '25 13:12 OlhaKorolova