Skip to main content

Emulator Support for Linux

About 2 min

Emulator Support for Linux

Preparation

You can choose one of the following installation methods:

Use maa-cli

maa-cliopen in new window is a simple CLI for MAA made with Rust. Please read installation and usage tutorials in User Guide for CLI.

Use Python

1. Installing dynamic library

  1. Download and extract Linux library in MAA Websiteopen in new window, or install from linux software repository:

  2. Open sample.py in ./MAA-v{VERSION}-linux-{ARCH}/Python/

Note
The precompiled version is built in a relatively new distro (Ubuntu 22.04), you may run into binary compatability problem, if libstdc++ in your environment is too old.
Where you should reference to Linux tutorial, or run inside a container instead.

2. adb Settings

  1. Target to if asst.connect('adb.exe', '127.0.0.1:5554'):open in new window

  2. adb Tools Settings

    • If you use avd in Android Studio as your emulator, it contains adb that you can use it directly. Just fill in your adb path in adb.exe, you can usually find it in $HOME/Android/Sdk/platform-tools/ , eg.:
    if asst.connect("/home/foo/Android/Sdk/platform-tools/adb", "avd_ID"):
    
    • If you use other emulators, you have to install adb first: $ sudo apt install adb and then fill in the path of adb or just fill in adb if you had put it into the PATH environment variable.
  3. Emulator adb ID Settings

    • You can use the adb tool directly: $ ${adb_path} devices , eg.:
    $ /home/foo/Android/Sdk/platform-tools/adb devices
    List of devices attached
    emulator-5554 device
    
    • emulator-5554 that the terminal returns is the ID of emulator adb, replacing 127.0.0.1:5555 with it, eg.:
    if asst.connect("/home/foo/Android/Sdk/platform-tools/adb", "emulator-5554"):
    
  4. Now you can test: $ python3 sample.py , if return 连接成功 , you almost finish setting.

3. Tasks Settings

Customizing tasks: Reference to AsstAppendTaskopen in new window and modify # 任务及参数请参考 docs/集成文档.mdopen in new window section in sample.py.

Emulator Supports

AVDopen in new window

Requests: Resolution should be 16:9 and above 720p

Recommendation: x86_64 architecture (R - 30 - x86_64 - Android 11.0) with Linux x64 动态库 in MAA

⚠️ Genymotionopen in new window

Native x86_64 architecture in high version of Android, light weight but easy to crash when running Arknights.

We have not testing strictly, but adb functions and path have no error.

Containerized Android

Note
The following solutions are likely to depend on special kernel modules, make sure to have them installed accordingly.

Waydroidopen in new window

Need to reset the resolution to 16:9 (You can set it above 720P):

waydroid prop set persist.waydroid.width 1280
waydroid prop set persist.waydroid.height 720

After restarting, record IP address in Setting - About phone , fill ${IP address}:5555 to the adb IP address in sample.py .

If you are using amdgpu, screencap command may write messages to stderr, causing image decoding error.
Run adb exec-out screencap | xxd | head to check if there is something like /vendor/etc/hwdata/amdgpu.ids: No such file... in the output.
Modify screencap commands in resource/config.json from adb exec-out screencap to adb exec-out 'screencap 2>/dev/null' as a workaround.

redroidopen in new window

Arknights runs properly in Android 11 image. Do remember to expose port 5555 for adb.