Files
shenleiandClaude Opus 5.5 8f96e7a143 Android device verification: forced landscape, fullscreen, data layering
- Ava2Activity passes the "args" intent extra as the command line
  (build.sh forwards AVA2_ARGS); it also always requests sensor landscape.
- app_loop sets SDL_HINT_ORIENTATIONS to landscape and creates the window
  fullscreen on Android/iOS (SDL requested FULL_USER for the resizable
  window, overriding the manifest; the status bar drew over the HUD).
- push_assets.py: pack-manifest test-rundir now wins over assets/loose
  (~1000 differing files; half-size tree atlases broke SpeedTree UVs),
  pushes in batches of <=20k files, and chmods shell-owned files so the
  app can read them on Android 17.
- PORT-PLAN: device verification results and outstanding gaps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 10:53:56 +09:00

57 lines
2.8 KiB
Markdown

# AVA2 Android client
Gradle project for the arm64-v8a APK: SDL3 `SDLActivity` + `libmain.so` (the client, with the
embedded CPython 2.7). The APK holds code only. Game data (`ymir work`, maps, sound, python-root,
`python27.zip`) lives in the app's external files directory, see below.
Architecture and roadmap: `docs/MOBILE-ARCHITECTURE.md`.
## Requirements
- Android SDK with platform 35, NDK 27.2.12479018 and CMake 3.22.1 (`sdkmanager "ndk;27.2.12479018" "cmake;3.22.1"`)
- JDK 17+ (`brew install openjdk@21`; `build.sh` finds it automatically)
- The SDK checkout beside this repository (`../sdk`), as for the desktop build
## Build
```bash
android/build.sh # debug APK; installs and launches it when a phone is attached
android/build.sh release # release APK
android/build.sh deps # only build SDL3 + FreeType into build/android-deps
```
The first run downloads and builds SDL3 and FreeType once into `build/android-deps`. The SDL
Java sources are copied from the same SDL release so they always match `libSDL3.so`. The debug
APK compiles C++ as RelWithDebInfo; a Debug build is too slow to judge frame rate.
Overrides: `ANDROID_HOME`, `ANDROID_NDK_HOME`, `JAVA_HOME`, `AVA2_SDK_ROOT`, `AVA2_SOURCE_DIR`
(CMake source tree to build instead of this checkout), `ADB_SERIAL`.
`AVA2_ARGS` passes client arguments to the launch (`Ava2Activity` reads the `args` intent
extra), e.g. `AVA2_ARGS="--phase game --preview-data" android/build.sh`, or by hand:
`adb shell "am start -n com.metin2.ava2/.Ava2Activity --es args '--phase game --preview-data'"`.
Android Studio can open this directory after `android/build.sh deps` has run once.
## Game data on the phone
```bash
android/push_assets.py # after android/build.sh, with the phone attached
```
Stages `assets/loose`, then `build/dev/test-rundir` (the pack-manifest root from
`tools/make_test_rundir.py`; its pack files win), then `upstream/python-root` (scripts win) and
`python27.zip` as hard links in
`build/android-data/root` and sends them with `adb push --sync` to
`/sdcard/Android/data/com.metin2.ava2/files`, where the client starts. The first push moves
about 4 GB; later pushes only send changed files. The three `assets/loose` symlinks into the
decoded pack_maker tree are remapped to `--pack-maker` (default `../AVA2/TEST/1. Client DEV/pack_maker`).
Uninstalling the app deletes this directory.
On Android 17 (OnePlus PJZ110) the directories `adb push` creates are `shell`-owned with mode
2770, so the app cannot enter them and the first model load dies with `posix_stat ... Permission
denied`. push_assets.py therefore runs `chmod` over the pushed tree afterwards (directories 2777,
files 666).
Running the desktop client inside `build/android-data/root` exercises the same flattened layout.
Logs: `adb logcat -s SDL SDL/APP AndroidRuntime DEBUG`.