格式化工具部分: 1. pre-commit 引入 python 的格式化工具,包括 black(代码格式化)和 isort(对“包导入顺序”的规范) 2. 允许 prettier 对文档站的 markdown 文件格式化 3. 不允许 prettier 对 markdown 文件中的代码块的代码本身进行格式化 4. 升级了 pre-commit 的各个 hook 的版本 5. 优化了 pre-commit 的日志文本显示 容器总览部分: 1. 由原来的单一轻量环境转为区分空环境、轻量环境和全量环境 2. 空环境是裸 Linux 镜像(Ubuntu),为默认环境 3. 轻量环境适合开发文档站前端 4. 全量环境适合开发 MaaCore 5. 目前,全量环境完整包含了轻量环境,轻量环境完整包含了空环境 6. 在仓库 README.md 中更新了三个环境的描述,并将链接分别设置为对应环境的创建链接 **注意:没有修改文档站中的对应文件** 7. 在各个语言的开发指南的最后,移除了 Codespace 部分的“安装额外依赖”相关描述,且将链接设置为全量环境的创建链接 **注意:没有添加“开发文档站”的指南和对应 codespace 的使用方式** 容器的轻量环境和全量环境共有部分: 1. 安装 black 和 isort 包 2. 调整 VS Code 设置,取消先前(对 markdown 文件单独指定 markdownlint 扩展作为格式化工具)的错误设置,现在 markdown 文件仍然使用默认的 prettier 扩展作为格式化工具 3. 引入 markdown-all-in-one 扩展作为语法提示工具 4. 将 node_modules 和 3rdparty 排除在 VS Code 的文本的搜索路径之外 容器的全量环境部分: 1. 为 tools 下的所有 python 脚本安装依赖 2. 使用 tools/maadeps-download.py 下载 maadeps,且将必要二进制文件软链接到 /usr/local/bin/ 3. 使用 apt 安装 cmake 和 clangd-20,将后者通过 update-alternatives 设置为系统 clangd 的默认版本 4. 使用 cmake tools 扩展,并按照 Linux 编译方法进行配置 5. 使用 clang-format 作为 c/cpp 的格式化工具,clang-format 程序主体来自 maadeps(已经软链接到 /usr/local/bin/) 6. 使用 clangd 作为 c/cpp 的语法提示工具 7. 将 MaaDeps、install 和 build 排除在 VS Code 的文本搜索路径之外 其它手动调整: 1. 更新文档站的 package.json,指定 pnpm 包管理器的版本 2. 手动保证 markdown 文件中的列表前后有空行(注意到 MarkdownLint 官方规则不一定能精准定位所有“列表前后空行”的问题,详见:https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md032---lists-should-be-surrounded-by-blank-lines ) 3. 修改了部分 markdown 文件中的 json 代码块的语法问题 **注意:相同的问题并未全部发现,仅修改了两处** 4. 在 tools 目录中,一处 python 脚本的包名误用(本地包名和某个 pip 包重名),这里修改了相应代码 5. 在 tools 目录中,一处 python 脚本使用了弃用的包 cchardet 的问题,这里更换了推荐使用的功能相近的包并修改了相应代码 自动化脚本提交的修改: 1. 自动格式化了大量 tools 中的 python 脚本 2. 自动格式化了大量 docs 中的 markdown 文件 Commits: * chore: pre-commit引入black和isort规范py文件 * chore: Auto update by pre-commit hooks [skip changelog] * chore: devcontainer添加isort扩展,排序python导入 * chore: pre-commit任务命名及更名 * style: isort fix * chore: Auto update by pre-commit hooks [skip changelog] * chore: 更新pre-commit的hook版本 * fix: 模块名与第三方库重名,大忌 * chore: 容器构建时额外安装isort * docs: md -> markdown * chore: 容器安装python包和maadeps * fix: 修复过时python包 * chore: 指定pnpm版本 * chore: container支持选择轻量环境 * chore: 去掉rust * chore: add plain env * chore: 使用clangd语言服务器 * chore: 无需单独设置markdown的格式化工具 * chore: 更新安装的clangd版本 * docs: 简易文档适配 * docs: 在仓库README中重新编排codespaces相关指引 * chore: Auto update by pre-commit hooks [skip changelog] * style: 调整缩进 * chore: 格式化工具不用特意排除被gitignore忽略的文件 * chore: sh文件在gitattributes中单列一类 * chore: 格式化docs下的markdown文件 * chore: 暂时不修改md文件中的代码块 * style: 人为明确markdown中的部分列表相关格式 * docs: 补上部分markdown的json代码块中缺失的逗号 * chore: Auto update by pre-commit hooks [skip changelog] * chore: Auto update by pre-commit hooks [skip changelog] * fix: 补上tools的服务器排序相关代码中缺失的逗号 Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * chore: 使用maadeps的clangd * build: 更新maadeps工具链版本 * style: prettier fix * revert: 还原maadeps版本 * revert: 取消使用maadeps的clangd依赖,改用系统apt安装 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
7.9 KiB
order, icon
| order | icon |
|---|---|
| 4 | mingcute:android-fill |
Android Physical Devices
::: warning This method involves ADB command-line usage, has lower stability, and still requires computer connection. Not recommended for beginners. :::
::: info Note
- Please also refer to Connection Settings.
- Starting from Android 10, Minitouch is no longer available when SELinux is in
Enforcingmode. Please switch to other touch modes, or temporarily switch SELinux toPermissivemode. - Due to the extreme complexity of the Android ecosystem, try changing the
Connection Configurationin MAASettings-Connection SettingstoGeneral Mode,Compatibility Mode,2nd Resolution, orGeneral Mode (Block Exception Output)until one mode works properly. - Since MAA only supports
16:9aspect ratios, devices with non-16:9or9:16screen ratios (including most modern devices) need to have their resolution forcibly changed. If your device's native screen ratio is16:9or9:16, you can skip theChange Resolutionsection. - Switch your device's navigation method to something other than
Full Screen Gestures, such asClassic Navigation Keys, to avoid accidental operations. - Please set the
Notched Screen UI Adaptationoption 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 and Run ADB Debug Tool to Connect Device
-
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 Debuggingon 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'sUSB InstallationandUSB 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
deviceis the device serial number, which is also your MAAConnection 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
.androidfolder in your user's personal directory and try again after restarting. Use search to find the exact location.
Change Resolution
::: 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>betweenadbandshell:# 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.
:::
Automate Resolution Changes
-
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.batand the second tofinish.bat.- If no confirmation dialog appears when changing the extension and the file icon doesn't change, search for "How to show file extensions in Windows."
-
In MAA's
Settings-Connection Settings, setStart Scripttostartup.batandEnd Scripttofinish.bat.
Connect to MAA
Wired Connection
::: tip
Wired connections don't need IP addresses or ports - just the device serial number from adb devices.
:::
- Enter the target device serial number from above into MAA's
Settings-Connection Settings-Connection Address. - Link Start!
Wireless Connection
- Ensure your device and computer are on the same network and can communicate with each other. Router settings like
AP IsolationorGuest Networkcan block device communication - check your router documentation. - Wireless debugging is disabled after device restart and must be re-enabled.
Using adb tcpip for Wireless Debugging
-
In 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:
- Go to your phone's
Settings-Wi-Fi, tap the connected network to view the IP address. - The location varies by manufacturer - search for instructions if needed.
- Go to your phone's
-
Enter
<IP>:5555in MAA'sSettings-Connection Settings-Connection Address, e.g.,192.168.1.2:5555. -
Link Start!
Using 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 Debuggingand enable it. TapPair device with pairing codeand keep the popup open until pairing completes. -
Complete the pairing:
- In the command prompt, type
adb pair <IP address and port shown in the device popup>and press Enter. - Enter the six-digit pairing code from the device popup and press Enter.
- When you see
Successfully paired to <IP:port>, the device popup will close automatically, and your computer's name will appear in the paired devices list.
- In the command prompt, type
-
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!
Using Root to Enable Wireless ADB
If you have access to root, why do you need to read this document
- Download, install WADB and grant it root privileges. 2.
- Open WADB and start wireless adb. 3.
- Put the IP address and port provided by WADB into MAA
Settings-Connection-Connection Address, such as192.168.1.2:5555. - Link Start!