Devices
BlueStacks ADB Not Working: Android Emulator ADB Fixes
Fix adb not working, device not found and offline errors for BlueStacks, LDPlayer, MuMu, MEmu and Nox in Macro Automation Studio, with adb commands to check.
- Windows
- Mac
- Emulator
- Phone
- Studio
On this page
Every local device in Macro Automation Studio (MAS) is an adb connection to 127.0.0.1:<port>. When adb is not working and a device will not start, the cause is almost always one of a handful of problems, and the same fixes apply to BlueStacks, LDPlayer, MuMu Player, MEmu and Nox. This page lists them with the commands you can run yourself.
How MAS uses adb
Knowing the sequence makes the errors readable. When you click Start on a device, MAS:
- Runs
adb start-serverwith its own adb build. - Lists devices with
adb devices -l. If your port is already listed, it disconnects it first. - Runs
adb connect 127.0.0.1:<port>and reads the output. Any of “cannot connect”, “failed to connect”, “unable to connect”, “connection refused” or “bad port” fails the device with “unable to connect to device”. - Sends every later command as
adb -s 127.0.0.1:<port> shell ...: taps, swipes,screencapfor screenshots,wm sizefor the screen size. - Runs
adb kill-serverwhen the app closes.
On Windows MAS ships adb under C:\ProgramData\MacroAutomationStudio\3rdparty\platform-tools. On Mac adb is inside the app bundle, with your PATH and Homebrew as fallbacks.
Check the connection yourself
Open a terminal and run the same steps MAS runs. Use the port from the emulator’s settings.
adb devices
adb connect 127.0.0.1:5555
adb -s 127.0.0.1:5555 shell wm sizeA healthy emulator answers the last line with Physical size: 540x960 or similar. When the output looks wrong, reset the server and try again:
adb kill-server
adb start-server
adb connect 127.0.0.1:5555Where to find adb: the emulators ship their own copies (Nox names it nox_adb.exe in its bin folder; MuMu Player keeps adb_server.exe under its install folder), MAS ships one on Windows, and on a Mac brew install android-platform-tools gives you the standard build.
Where the ADB setting lives
| Emulator | Switch ADB on | First instance port | More instances |
|---|---|---|---|
| BlueStacks 5 | Settings, Advanced tab, switch on Android Debug Bridge | 5555, or another port when 5555 is taken | Each instance gets its own port; MAS accepts 5555 to 8500 |
| LDPlayer | Settings, Other settings, set ADB debugging to Open local connection, click Save settings, restart the instance | 5555 | 5557, 5559 and so on; MAS accepts odd ports to 5599 |
| MuMu Player | The port is shown under Settings, ADB port, or in Device Diagnostic | 16384 (older versions: 7555) | Each instance adds 32: 16416, 16448 and so on |
| MEmu | On by default; the host port maps to the Android port 5555 | 21503 | 21513, 21523 and so on |
| Nox | On by default; connect with nox_adb.exe connect 127.0.0.1:62001 from the bin folder | 62001 | Ports above 62001 up to 63000 |
Vendor pages: BlueStacks, LDPlayer, MuMu Player, MEmu, Nox.
BlueStacks ADB not working and other emulator errors
ADB not working
Nothing connects: the Port list in MAS is empty and adb connect reports “cannot connect” or “connection refused”.
Cause: ADB is switched off in the emulator, or the instance has not finished booting. BlueStacks and LDPlayer ship with ADB off.
- Switch ADB on using the table above and restart the instance where the vendor says so.
- Wait until the Android home screen is up, then click Refresh in Add New Device.
- Run
adb connect 127.0.0.1:<port>in a terminal. “connected to 127.0.0.1:” means MAS will connect too. - If a security tool blocks local connections, allow adb and the emulator through it.
ADB device not found
The device card ends in Error and the log says “unable to connect to device”, or a script raises DeviceNotConnectedError on its first call.
Cause: the port belongs to nothing, the emulator closed, or the connection dropped after the run started.
- Compare the port on the device card with the one in the emulator’s settings. Fix it with Edit Device.
- Run
adb devices. If the entry is missing, runadb connect 127.0.0.1:<port>and read the reply. - Restart the emulator instance, then click Start again. MAS reconnects from scratch on every start.
- If you started MAS before the emulator, click Refresh so the port list is current.
Device shows offline
adb devices lists 127.0.0.1:<port> offline and commands hang or return nothing.
Cause: the adb server holds a stale entry, two adb builds of different versions are fighting over the server, or the emulator is still booting.
- Run
adb kill-server, thenadb connect 127.0.0.1:<port>again. - Close other tools that start their own adb server (Android Studio, another emulator’s console) while MAS runs.
- Restart the emulator instance. Nox’s own advice for “null or offline” is the same: restart Nox and connect again.
- Wait for the boot to finish; an instance that is still loading answers
offline.
Wrong or changed ADB port
The device worked yesterday and fails today with the same settings.
Cause: emulators hand out ports when an instance starts, and creating, cloning or deleting instances shifts them. BlueStacks moves to another port when 5555 is busy.
- Read the current port from the emulator’s settings or from
adb devicesafter the instance boots. - In MAS, open the device card, click Edit Device, set the new port and save.
- For a stable setup, keep instances in the same order in the emulator’s multi-instance manager and avoid deleting the first one.
Several instances
Only the first instance connects, or MAS reports “Port is already in use”.
Cause: every instance needs its own port and its own device entry; a port can be added once.
- Add one device per instance, each with the instance’s port. The ranges are in the table above: LDPlayer and MuMu Player use odd ports 5555, 5557, 5559; MuMu Player 12 adds 32 per instance; MEmu adds 10; Nox counts up from 62001.
- Give each device a name that matches the instance name so the cards are easy to tell apart.
- Start instances one at a time and click Refresh so each new port appears in the list.
- Same macro, different accounts: use settings profiles so each device follows its own arguments. See Device groups.
adb on Mac
MAS shows “ADB executable not found. Please install ADB using your package manager”.
Cause: the adb inside the app bundle could not be run and nothing was found on your PATH or under /opt/homebrew.
- Install the standard build with
brew install android-platform-tools, then restart MAS. - Check with
which adbandadb versionin Terminal. MAS looks in the app bundle, then on the PATH, then in/opt/homebrew/binand/usr/local/bin. - On a Mac the emulator must run on the Mac as well; MAS always dials
127.0.0.1. - If your Mac emulator build has no ADB at all, a cloud device runs without any local adb.
Which emulator ADB ports MAS scans
MAS builds the Port list from running processes, not from adb devices. It keeps a port only when the process name and the port range both match:
| Emulator | Process names | Ports kept |
|---|---|---|
| BlueStacks | HD-Player, BlueStacks | 5555 to 8500 |
| LDPlayer | LdVBoxHeadless, Ld9BoxHeadless, dnplayer, LDPlayer, VBoxNetNAT | Odd ports 5555 to 5599 |
| Nox | NoxVMHandle | 62001 to 63000 |
| MEmu | MEmuHeadless, MEmuHyper | 21503 and every port ending in 3 up to 29993 |
| MuMu Player | NemuHeadless, MuMu | Odd ports 5555 to 5599, 7555, 16384 to 16576, 26624 to 27264 |
Only ports bound to 127.0.0.1, 0.0.0.0 or all interfaces are considered. A port outside these rules never appears in the list, but Custom Port accepts any value from 1024 to 65535, so an emulator MAS does not know can still be added by hand.
Still stuck
Collect the device card’s Logs (the Save button writes them to a file), the output of adb devices, and the emulator name and version, then ask in Discord or email support@automationmacro.com. General app problems are on the Troubleshooting page.
Next steps
Related pages
Thanks. If something is wrong, tell us in Discord.
Questions? Ask in Discord