Emulator Support for Linux
Emulator Support for Linux
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 Python
1. Installing dynamic library
Download and extract
Linux library
in MAA Website, or install from linux software repository:- AUR:maa-assistant-arknights, edit the script according to the post-install instruction.
- Nixpkgs: maa-assistant-arknights
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
adb
Tools Settings- If you use
avd
inAndroid Studio
as your emulator, it containsadb
that you can use it directly. Just fill in youradb
path inadb.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 inadb
if you had put it into thePATH
environment variable.
- If you use
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, replacing127.0.0.1:5555
with it, eg.:
if asst.connect("/home/foo/Android/Sdk/platform-tools/adb", "emulator-5554"):
- You can use the adb tool directly:
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.