“LDPlayer ADB Guide: Connecting to Instances and Running Common Commands”
Each LDPlayer instance is reachable through an ADB (Android Debug Bridge) port. You can use the standard `adb` tool with it, so you do not need a separate wrapper. This guide shows how to find an instance's serial number, connect to one ins
Before You Start
Prerequisites: LDPlayer installed, with at least one instance running.; Command Prompt, opened in your LDPlayer installation folder. The examples assume `adb` runs from that folder, for example `E:LDPlayerLDPlayer14`.
Step-by-Step
- Open the LDPlayer installation folder in File Explorer. In the address bar, type cmd, then confirm the entry.
- Run `adb devices` to list the serial number of each running instance.
- Run `adb shell` to open an Android shell on the instance. Use this when only one instance is running.
- For several instances, add `-s <serial>` to each command. For example: `adb -s emulator-5554 shell pm list packages -3`.
- For commands that need root, open Settings Center > Other in the instance and turn on Enable ROOT permission.
- Run `adb root` to restart the ADB daemon with root permission.
- Run `adb shell` again. The prompt should end with `#` instead of `$`.
## Overview Each LDPlayer instance is reachable through an ADB (Android Debug Bridge) port. You can use the standard adb tool with it, so you do not need a separate wrapper. This guide shows how to find an instance’s serial number, connect to one instance or several, enable root, and run common commands for installs, input, files, screenshots, and device information.
## Verify Run adb devices. Each running instance should appear with the status device.
## Reference: common commands
Add -s <serial> to each command when more than one instance is running.
Install and uninstall apps
adb install C:\xx.apk
adb install -r C:\xx.apk # overwrite, keeping data
adb uninstall <package_name>
Find packages and the foreground app
adb shell pm list packages # all packages
adb shell pm list packages -3 # third-party apps
adb shell pm list packages -s # system apps
adb shell dumpsys window | findstr mCurrentFocus
adb shell cmd package resolve-activity --brief <package_name> | tail -n 1
adb shell dumpsys package <package_name> | findstr version
adb shell pm clear <package_name>
Simulate input
| Action | Command | Notes | | — | — | — | | Press a key | adb shell input keyevent <code> | Code 3 is Home and code 4 is Back | | Enter text | adb shell input text hello | Does not accept Chinese characters | | Tap | adb shell input tap X Y | X and Y are pixel coordinates | | Swipe | adb shell input swipe X1 Y1 X2 Y2 [ms] | Duration defaults to 100 ms | | Long press | adb shell input swipe X Y X Y | Same start and end point | | Open an activity | adb shell am start -n <package/activity> | Use the activity lookup command above |
Files, screenshots, and recording
adb push C:\test.apk /sdcard/
adb pull /sdcard/test.apk C:\
adb shell screencap /sdcard/screen.png
adb pull /sdcard/screen.png C:\
adb shell screenrecord /sdcard/test.mp4 # press CTRL+C to stop
adb pull /sdcard/test.mp4 C:\
Device information and cleanup
adb shell getprop ro.product.model
adb shell getprop ro.product.brand
adb shell getprop ro.product.board
adb shell getprop ro.build.version.release
adb shell wm size
adb shell dumpsys SurfaceFlinger | findstr "GLES"
adb shell settings put global development_settings_enabled 0
## Notes and Troubleshooting
- Instance 0 usually appears as
emulator-5554, instance 1 asemulator-5556, and each further instance adds 2 to the port. The actual serials are the ones thatadb devicesprints on your PC. - Without
-s, adb reports “more than one device/emulator” when several devices are connected. Add-s <serial>in scripts. - A serial stays registered while its instance runs. If adb disconnects, it usually reconnects within a few seconds. Closing the instance or running
adb kill-serverremoves the connection, but a later adb command registers the device again. - Instance 0 of LDPlayer 9 and instance 0 of LDPlayer 14 both try to use port 5555. If both run at once, the second one may not appear in
adb devices. Run only one of them. - Use Windows drive letters such as
C:\in push and pull paths, not/c/.
## Related