docs/en-us/manual/device/android.md
::: warning This method involves ADB command-line usage, has lower stability, and still requires computer connection. Not recommended for beginners. :::
::: info Note
Enforcing mode. Please switch to other touch modes, or temporarily switch SELinux to Permissive mode.Connection Configuration in MAA Settings - Connection Settings to General Mode, Compatibility Mode, 2nd Resolution, or General Mode (Block Exception Output) until one mode works properly.16:9 aspect ratios, devices with non-16:9 or 9:16 screen ratios (including most modern devices) need to have their resolution forcibly changed. If your device's native screen ratio is 16:9 or 9:16, you can skip the Change Resolution section.Full Screen Gestures, such as Classic Navigation Keys, to avoid accidental operations.Notched Screen UI Adaptation option in the game settings to 0 to avoid task errors.:::
::: tip
Typical 16:9 resolutions include 3840x2160 (4K), 2560x1440 (2K), 1920x1080 (1080P), and 1280x720 (720P).
:::
Download ADB and extract it.
Open the extracted folder, clear the address bar, type cmd, and press Enter.
In the command prompt window that appears, type adb. If you see extensive help text, the command ran successfully.
Enable USB Debugging on your phone. The process varies by manufacturer, so use a search engine to find instructions. Manufacturers may provide additional USB debugging options, such as MIUI's USB Installation and USB Debugging (Security Settings) - enable these too.
Connect your phone to the computer with a data cable and enter the following command in the command prompt:
adb devices
When executed successfully, it will show connected USB debugging devices.
Example of a successful connection:
List of devices attached
VFNDU1682100xxxx device
The alphanumeric combination before device is the device serial number, which is also your MAA Connection Address.
Modern Android devices require authorization on the device itself. Without authorization, you'll see:
List of devices attached
VFNDU1682100xxxx unauthorized
If you consistently get "unauthorized" or "offline" status, restart both your device and computer. If that doesn't help, delete the .android folder in your user's personal directory and try again after restarting. Use search to find the exact location.
::: tip
Mobile screen resolution is specified as short edge × long edge, not long edge × short edge as with computer monitors. Determine the appropriate values for your specific device.
:::
If you only have one device in your device list, run these commands to change/restore resolution:
# View current resolution
adb shell wm size
# Restore default resolution
adb shell wm size reset
# Change to 720p
adb shell wm size 720x1280
# Change to 1080p
adb shell wm size 1080x1920
If you have multiple devices, add the parameter -s <target device serial number> between adb and shell:
# View current resolution
adb -s VFNDU1682100xxxx shell wm size
# Restore default resolution
adb -s VFNDU1682100xxxx shell wm size reset
# Change to 720p
adb -s VFNDU1682100xxxx shell wm size 720x1280
# Change to 1080p
adb -s VFNDU1682100xxxx shell wm size 1080x1920
Some apps with irregular designs may still have layout issues after resolution restoration. Usually, restarting the app or device resolves this.
::: danger Warning
Strongly recommended to restore the default resolution before restarting your device. Otherwise, depending on your device, unpredictable consequences may occur, including layout chaos, touch misalignment, app crashes, inability to unlock, etc.
:::
::: danger Warning
It is known that the Account Switching feature may not work properly on some physical devices. MAA primarily works in PC emulator environments, so there are no plans to fix this issue.
If you encounter this problem, you can modify the screen density (DPI) through any of the following methods (recommended value range: [100-800]):
adb shell wm density <DPI> to directly modify the DPIDeveloper Options → Minimum Width to indirectly modify the DPI by changing the Minimum Width Note: DPI and Minimum Width are inversely proportional, with the conversion formula: Minimum Width = Screen Width(px) / (DPI / 160)
Be aware that this operation carries risks and may cause the device to malfunction. Please ensure you know what you are doing. You are responsible for any device failures.
It is strongly recommended to revert these changes before the next device reboot. If you forget the default values, regardless of which method was used to modify them, you can always use the command adb shell wm density reset to restore them.
:::
Create two text files in the MAA directory with the following content:
# Adjust resolution to 1080p
adb -s <target device serial number> shell wm size 1080x1920
# Lower screen brightness (optional)
adb -s <target device serial number> shell settings put system screen_brightness 1
# Restore resolution
adb -s <target device serial number> shell wm size reset
# Increase screen brightness (optional)
adb -s <target device serial number> shell settings put system screen_brightness 20
# Return to home screen (optional)
adb -s <target device serial number> shell input keyevent 3
# Lock screen (optional)
adb -s <target device serial number> shell input keyevent 26
Rename the first file to startup.bat and the second to finish.bat.
In MAA's Settings - Connection Settings, set Start Script to startup.bat and End Script to finish.bat.
::: tip
Wired connections don't need IP addresses or ports - just the device serial number from adb devices.
:::
Settings - Connection Settings - Connection Address.AP Isolation or Guest Network can block device communication - check your router documentation.adb tcpip for Wireless DebuggingIn the command prompt, enable wireless debugging:
adb tcpip 5555
# Add -s parameter to specify the serial number if multiple devices are connected
Find your device's IP address:
Settings - Wi-Fi, tap the connected network to view the IP address.Enter <IP>:5555 in MAA's Settings - Connection Settings - Connection Address, e.g., 192.168.1.2:5555.
Link Start!
adb pair for Wireless Debugging::: tip
adb pair wireless pairing (available in Android 11 and later via Developer Options) allows connection without a physical USB connection, unlike adb tcpip.
:::
On your phone, go to Developer Options, tap Wireless Debugging and enable it. Tap Pair device with pairing code and keep the popup open until pairing completes.
Complete the pairing:
adb pair <IP address and port shown in the device popup> and press Enter.Successfully paired to <IP:port>, the device popup will close automatically, and your computer's name will appear in the paired devices list.Enter the IP address and port shown on your device screen into MAA's Settings - Connection Settings - Connection Address, e.g., 192.168.1.2:11451. This is different from the address used for pairing.
Link Start!
If you have access to root, why do you need to read this document
Settings - Connection - Connection Address, such as 192.168.1.2:5555.