Package the Android build as an installable APK

The arm64 job stopped at the three shared libraries, so the only way to
use them was to build a player around them. Let the libraries go into
mpv-android's jniLibs and let Gradle assemble and sign the app instead.

- copy libmpv.so, libjoc_core.so and libc++_shared.so into
  app/src/main/jniLibs/arm64-v8a
- locate the SDK under buildscripts/sdk, accept its licences, and link
  the unpacked NDK where AGP looks for it
- run assembleRelease with a throwaway injected signing key, so the APK
  installs without repository secrets
- verify the signature when apksigner is available and upload the APK as
  mpv-joc-android-arm64-v8a-apk, keeping the bare libraries as before
- cache the Gradle home between runs
- document the artifact and how to pass the ad_joc options

Checked locally: the workflow parses and every shell block passes
bash -n; the Gradle build itself needs a CI run.
This commit is contained in:
TheM14 committed 2026-10-31 02:47:40 +08:00
1 parent ecf14d8c32
commit c45808135d
3 files changed
+118 -3

No files matched your search

+17 -2
View File
@@ -53,10 +53,25 @@
1. CI 先只做 **arm64 的 joc_core 交叉编译**,产出 `libjoc_core.so`。这一步最快暴露平台问题。
2. 再跑 mpv-android 的 buildscripts + 我们的 patch,产出 arm64 的 `libmpv.so`。
3. 在 mpv-android 里加一个最小 demo:`jniLibs/arm64-v8a/libjoc_core.so`,启动参数加
`--ad=joc --ad-joc-hrtf=...`,用 `adb logcat -s mpv` 验证开始渲染。
3. CI 把 `libmpv.so`、`libjoc_core.so`、`libc++_shared.so` 放进 app 的
`jniLibs/arm64-v8a/`,再 `./gradlew assembleRelease` 打出可安装的 APK;在 mpv 的
配置文件里加 `--ad=joc --ad-joc-hrtf=...`,用 `adb logcat -s mpv` 验证开始渲染。
4. 对拍:手机上把输出写成 WAV(`--ao=pcm`),拉回 PC 与 `joc_cli` 比较,确认 NEON 路径正确。
## CI 产物
`build-android.yml` 的 arm64 任务现在产出两类工件:
- `mpv-ad-joc-android-arm64-v8a`:`libmpv.so`、`libjoc_core.so`、`libc++_shared.so`,
给已经自己编好的 mpv 用;
- `mpv-joc-android-arm64-v8a-apk`:上面这三个库已经打进 mpv-android 的
`jniLibs/arm64-v8a/`,由 `assembleRelease` 打包并签名,安装包直接可装。
签名用的是 CI 现场生成的临时 keystore(`-Pandroid.injected.signing.*`),只保证可安装,
不代表发布身份;要正式分发就把这段换成仓库 secret 里的 keystore。APK 里仍是原版
mpv-android 界面,`--ad=joc`、`--ad-joc-hrtf=` 等参数要在应用能读到的 `mpv.conf`
里给出,HRTF 文件也要放在应用可访问的目录。
## 参考
- mpv-android 构建脚本:https://github.com/mpv-android/mpv-android/tree/master/buildscripts