Skip to content

[MCP x Android] "Unable to launch app" on consecutive run calls #3142

@leonam13

Description

@leonam13

Is there an existing issue for this?

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

Steps to reproduce

Device: Android emulator — Pixel 9 Pro (emulator-5554)
OS Version: Android (emulator, arm64, OS Android 16 API 36) (But is reproducible with any other android device/emulator).
Maestro Version: 2.4.0 (also reproducible in 2.3.0)
AI Agent Tool in which the issue was reproducible: Claude Code, Firebender, Cursor.

Steps to Reproduce

  1. Start an AI agent session and confirm maestro MCP is connected.
  2. Ensure an Android emulator is running and connected (verified via list_devices — device shows connected: true)
  3. Call launch_app with device_id: "emulator-5554" and appId: "target_app_id_installed_in_the_device" — succeeds
  4. Call stop_app with the same device_id and appId — succeeds
  5. Call launch_app again with the same device_id and appId

Actual results

  • Call launch_app again with the same device_id and appId — fails with error: "Unable to launch app target_app_id_installed_in_the_device"
  • Retrying calling stop_app followed by launch_app again also fails with the same error.
  • Same thing happens when the agent try with run_flow or run_flow_files and the test file uses - launchApp: command.

Expected results

The Agent should be able to launch the app and flows multiple times within the same session

About app

  • Closed source project

  • Native Android app

  • Framework: Mix of Android Views and Jetpack Compose (1.8.0-rc01)

  • Compose version: 1.8.0-rc01

  • minSdk: 26

  • targetSdk: 35

  • compileSdk: 35 (same as target)

  • Claude Code version: 2.1.81

  • Firebender 1.0.1

About environment

  • Java version: OpenJDK 17.0.18 (Homebrew)
  • OS: macOS 26.4 (Tahoe)
  • Processor architecture: arm64 (Apple Silicon)

Logs

The Maestro logs are empty — both maestro.log (0 bytes) and the bugreport zips contain an empty log file. (MCP issue?)

  Run 1 (success):                                                                                                                
  {                                                                                                                             
    "success": true,                                                                                                              
    "device_id": "emulator-5554",                                                                                               
    "total_files": 1,            
    "total_commands_executed": 15,
    "results": [                                                                                                                  
      {         
        "file": "search_by_product_test.yaml",                     
        "success": true,                                                                                                        
        "commands_executed": 15,                                                                                                  
        "message": "Flow executed successfully"                                                                                 
      }                                                                                                                           
    ],                                                                                                                          
    "message": "All flows executed successfully"
  }

  Run 2 (failure):
 {                                                                                                                               
    "success": false,                                                                                                           
    "device_id": "emulator-5554",
    "total_files": 1,            
    "total_commands_executed": 0,                                                                                                 
    "results": [                 
      {                                                                                                                           
        "file": "search_by_product_test.yaml",                     
        "success": false,                                                                                    
        "error": "Unable to launch app xxxx",                                                      
        "message": "Flow execution failed"                                  
      }                                                                                                                           
    ],                                                                                                                          
    "message": "Some flows failed to execute"                                                                                     
  }  

Run 3 (after stop_app, same failure):
  {                                                                                                                               
    "success": false,
    "device_id": "emulator-5554",                                                                                                 
    "total_files": 1,                                                                                                           
    "total_commands_executed": 0,                                                                                                 
    "results": [                                                                                                                
      {         
        "file": "search_by_product_test.yaml",                     
        "success": false,                                                                                    
        "error": "Unable to launch app xxxx",                                                      
        "message": "Flow execution failed"                                  
      }                                                                                                                           
    ],                                                                                                                            
    "message": "Some flows failed to execute"
  }  

Maestro version

2.4.0

How did you install Maestro?

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

Anything else?

My Use Case:
We're leveraging of AI to run and fix our E2E tests. We're using the MCP so agents can smoothly execute maestro commands. In our current workflow a test is considered green when it passed twice in a row, since we can't run the second time, the workflow breaks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions