android: build.sh installs and syncs the game files when a phone is attached

After building the APK, android/build.sh now picks the attached device (ANDROID_SERIAL for several),
installs the APK (reinstalling on a signature mismatch), syncs the zh client into files/Client and, with
--launch, wakes the phone and starts the app. Without a device it only builds.

push-client.sh is now incremental (android/sync_client.py): the device keeps files/Client/.mt_sync
(size, mtime, path of what the last sync wrote), so later syncs send only new and changed files as one
tar streamed through `adb shell -T run-as` (no copy in /data/local/tmp) and delete the ones gone
locally. Only game resources are synced; settings and logs the app writes there are kept. --locale zh
rebuilds build/zh-locale/Client first when its inputs changed. android/adb_env.sh picks adb and falls
back to server port 5038 when :5037 cannot bind.

Verified against a fake adb device: first sync (1.4 GB, byte-identical), no-op resync, changed files,
deletions, locale switch, --full, the install/launch path and the no-device path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-09-30 16:36:21 +09:00
co-authored by Claude Opus 5.5
parent f9cd63713f
commit cd9e5b259d
10 changed files with 363 additions and 64 deletions
+3 -4
View File
@@ -19,12 +19,11 @@ cmake --build build/release --target mt_native_render -j8
## Android
```sh
./android/build.sh Release --install
./android/push-client.sh /path/to/40250/Client
adb shell am start -n org.metin2port.client/.MainActivity
./android/build.sh # 构建 APK;连着手机时自动安装并增量推送中文资源
./android/build.sh --launch # 同上,完成后唤醒手机并启动
```
APK 由 SDLActivity、`libSDL3.so` 和 Vulkan 原生 `libmain.so` 组成。40250 `Client` 资源单独复制到应用数据目录;`--live-server HOST:AUTH_PORT:GAME_PORT --login-screen` 可连接服务器。构建与启动细节见 [src/host/README.md](src/host/README.md)。
APK 由 SDLActivity、`libSDL3.so` 和 Vulkan 原生 `libmain.so` 组成。40250 `Client` 资源单独同步到应用数据目录(`android/push-client.sh`,只传有变化的文件);`--live-server HOST:AUTH_PORT:GAME_PORT --login-screen` 可连接服务器。构建与启动细节见 [src/host/README.md](src/host/README.md)。
## 测试