docs: add docs & emulator support for linux users (#4996)

This commit is contained in:
MistEO
2023-05-30 21:16:13 +08:00
committed by GitHub

View File

@@ -0,0 +1,59 @@
# Linux模拟器支持
## 准备工作
### 1. 文件准备
1. 在 [MAA 官网](https://maa.plus/) 下载 Linux 动态库并解压
2. 进入 `./MAA-v{版本号}-linux-x{框架}/Python/` 目录下打开 `sample.py` 文件
### 2. `adb` 配置
1. 找到 [`if asst.connect('adb.exe', '127.0.0.1:5555'):`](https://github.com/MaaAssistantArknights/MaaAssistantArknights/blob/722f0ddd4765715199a5dc90ea1bec2940322344/src/Python/sample.py#L48) 一栏
2. `adb` 工具调用
- 如果模拟器使用 `avd` 自带 `adb` ,可以直接在 `adb.exe` 一栏填写 `adb` 路径,一般在 `~/Android/Sdk/platform-tools/` 里面可以找到,例如:
```python
if asst.connect("/home/foo/Android/Sdk/platform-tools/adb", "模拟器的 adb 地址"):
```
- 如果使用其他模拟器须先下载 `adb` `$ sudo apt install adb` 后填写路径或全局变量直接写 `adb` 即可
3. 模拟器 `adb` 路径获取
- 可以直接使用 adb 工具: `$ adb路径 devices` ,例如:
```shell
$ /home/foo/Android/Sdk/platform-tools/adb devices
List of devices attached
emulator-5555 device
```
- `emulator-5555` 就是模拟器的adb地址填入 `127.0.0.1:5555` ,例如:
```python
if asst.connect("/home/foo/Android/Sdk/platform-tools/adb", "emulator-5555"):
```
4. 这时候可以测试下: `$ python3 sample.py` ,如果返回 `连接成功` 则基本完成了
### 3. 任务配置
自定义任务: 根据需要参考 [3.x 集成文档](https://maa.plus/docs/3.1-%E9%9B%86%E6%88%90%E6%96%87%E6%A1%A3.html) 对 [# 任务及参数请参考 docs/集成文档.md](https://github.com/MaaAssistantArknights/MaaAssistantArknights/blob/722f0ddd4765715199a5dc90ea1bec2940322344/src/Python/sample.py#L54) 一栏进行修改
## 模拟器支持
### ✅ [AVD](https://developer.android.com/studio/run/managing-avds)
必选配置: 16:9 的屏幕分辨率,且分辨率需大于 720p
推荐配置: x86_64 的框架 (R - 30 - x86_64 - Android 11.0) 配合 MAA 的 Linux x64 动态库
### ⚠️ [Genymotion](https://www.genymotion.com/)
高版本安卓自带 x86_64 框架,轻量但是明日方舟易闪退
暂未严格测试, adb 功能和路径获取没有问题