Files
MaaAssistantArknights/docs/en-us/manual/device/linux.md
Loong f2ab4946ce ci: use lychee to check dead links (#9675)
* ci: use lychee to check dead links

* ci: comment on PR when dead links are found

* docs: fix broken links
2024-07-17 15:26:17 +01:00

6.6 KiB
Raw Blame History

order, icon
order icon
3 teenyicons:linux-alt-solid

Linux Emulator and Container

Preparation

You can choose one of the following installation methods:

Use maa-cli

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

Use Wine

The MAA WPF GUI can currently be run using Wine.

Installation Steps

  1. Go to the .NET Release Page to download and install the .NET Desktop Runtime for Windows.

  2. Download MAA for Windows, unzip it and run wine MAA.exe.

::: info Note You need to set the ADB path to adb.exe for Windows in the connection settings.

If you need to connect to USB devices via ADB, please run adb start-server outside of Wine first, i.e. connect to the native ADB server via Wine. :::

Use Linux native MaaCore (experimental feature)

Download the MAA Wine Bridge source and build it, replace the Windows version with the generated MaaCore.dll (ELF file) in the same directory as the Linux native dynamic libraries (libMaaCore.so and dependencies).

Running MAA.exe through Wine will load the Linux native libraries.

::: info Note To use Linux native MaaCore, you need to set the ADB path to Linux native ADB in the connection settings. :::

Linux Desktop Integration (experimental feature)

Desktop integration provides native desktop notification support and the ability to map fontconfig font configurations to WPF.

Enable it by placing MaaDesktopIntegration.so generated by MAA Wine Bridge in the same directory as MAA.exe.

Known Issues

  • Wine DirectWrite forces hinting to be enabled and does not pass DPI to FreeType, resulting in poor font display.
  • When not using native desktop notifications, the popup notification will grab the system-wide mouse focus, making it impossible to operate other windows. This can be mitigated by enabling virtual desktop mode via winecfg, or disabling desktop notifications.
  • Wine-staging users need to disable the Hide Wine Version option in winecfg in order for MAA to properly detect the Wine environment.
  • Wine's Light theme causes some text colours in WPF to be abnormal, it is recommended to switch to no theme (Windows Classic theme) in winecfg.
  • Wine uses the old XEmbed tray icon, which may not work properly under GNOME.
  • Auto-update is not supported when using Linux native MaaCore (Updater: I think I should download a Windows version).

Use Python

1. Installing dynamic library

  1. Download and extract Linux library in MAA Website, 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'):

  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 AsstAppendTask and modify # 任务及参数请参考 docs/集成文档.md section in sample.py.

Emulator Supports

AVD

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

⚠️ Genymotion

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.

Waydroid

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.

redroid

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