Package the ffmpeg shared libraries the Android build links against

The Android libmpv.so has DT_NEEDED entries for libavcodec, libavfilter,
libavformat, libavutil, libswresample, libswscale and libavdevice, but
the app only carried libmpv.so, libjoc_core.so and libc++_shared.so, so
the linker rejected libmpv at dlopen time and the player crashed on
every file.

Copy every shared object from the cross-build prefix into the app's
libs/<abi> directory, and into the standalone library artifact too,
instead of naming the three files.
This commit is contained in:
TheM14 committed 2026-10-31 03:33:27 +08:00
1 parent 8ed49a1170
commit 8673a3b762
3 files changed
+40 -9

No files matched your search

+27 -7
View File
@@ -139,7 +139,7 @@ jobs:
ndk="$GITHUB_WORKSPACE/android/buildscripts/sdk/android-ndk-${v_ndk}"
out=dist/arm64-v8a
mkdir -p "$out"
cp android/buildscripts/prefix/arm64/lib/libmpv.so "$out/"
cp android/buildscripts/prefix/arm64/lib/*.so "$out/"
cp joc/build-android/libjoc_core.so "$out/"
libcxx=$(find "$ndk/toolchains/llvm/prebuilt" \
-path '*/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so' -print -quit)
@@ -179,7 +179,11 @@ jobs:
fi
libs="$main/libs/$abi"
mkdir -p "$libs"
cp "$GITHUB_WORKSPACE/android/buildscripts/prefix/arm64/lib/libmpv.so" "$libs/"
# This build links the ffmpeg stack dynamically, so the app needs
# every shared object from the cross-build prefix, not just libmpv.so
# (libmpv's DT_NEEDED lists libav*/libsw*).
find "$GITHUB_WORKSPACE/android/buildscripts/prefix/arm64/lib" \
-maxdepth 1 -type f -name '*.so*' -exec cp -t "$libs" {} +
cp "$GITHUB_WORKSPACE/joc/build-android/libjoc_core.so" "$libs/"
source "$GITHUB_WORKSPACE/android/buildscripts/include/depinfo.sh"
libcxx=$(find "$GITHUB_WORKSPACE/android/buildscripts/sdk/android-ndk-${v_ndk}/toolchains/llvm/prebuilt" \
@@ -260,26 +264,42 @@ jobs:
run: |
set -euo pipefail
mkdir -p dist/apk
mapfile -t apks < <(find "$GITHUB_WORKSPACE/android/app/build/outputs/apk" -name '*.apk' -print)
if [ ${#apks[@]} -eq 0 ]; then
mapfile -t built < <(find "$GITHUB_WORKSPACE/android/app/build/outputs/apk" -name '*.apk' -print)
if [ ${#built[@]} -eq 0 ]; then
echo "::error::the Gradle build finished without an APK"
find "$GITHUB_WORKSPACE/android/app/build/outputs" -maxdepth 4 -type f | head -40
exit 1
fi
# One installable APK is enough: the allstorage flavour covers normal
# playback and full file access, and the universal variant keeps the
# ABI splits from multiplying the artifact.
selected=()
for apk in "${built[@]}"; do
case "$apk" in *allstorage*universal*) selected+=("$apk") ;; esac
done
if [ ${#selected[@]} -eq 0 ]; then
for apk in "${built[@]}"; do
case "$apk" in *allstorage*) selected+=("$apk") ;; esac
done
fi
if [ ${#selected[@]} -eq 0 ]; then
echo "::warning::no allstorage APK found; uploading every variant"
selected=("${built[@]}")
fi
apksigner=$(find "$GITHUB_WORKSPACE/android/buildscripts/sdk" -path '*/build-tools/*/apksigner' -type f -print -quit 2>/dev/null || true)
for apk in "${apks[@]}"; do
for apk in "${selected[@]}"; do
if [ -n "$apksigner" ]; then
"$apksigner" verify --print-certs "$apk" | head -2
fi
done
cp "${apks[@]}" dist/apk/
cp "${selected[@]}" dist/apk/
ls -lh dist/apk
- name: Upload the Android APK
if: success()
uses: actions/upload-artifact@v4
with:
name: mpv-joc-android-arm64-v8a-apk
name: mpv-joc-android-apk
path: dist/apk/
if-no-files-found: error
+4 -2
View File
@@ -64,8 +64,10 @@
- `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` 打包并签名,安装包直接可装。
- `mpv-joc-android-apk`:一个 `app-allstorage-universal-release.apk`,上面这三个库
已经打进 mpv-android 的 `libs/arm64-v8a/`,由 `assembleRelease` 打包并签名,
直接可装。mpv-android 本身会出 `default` / `allstorage` × `arm64-v8a` / `universal`
四个包,CI 只保留 allstorage 的 universal 版:权限最全,ABI 拆包也不会让工件变多。
签名用的是 CI 现场生成的临时 keystore(`-Pandroid.injected.signing.*`),只保证可安装,
不代表发布身份;要正式分发就把这段换成仓库 secret 里的 keystore。APK 里仍是原版
+9
View File
@@ -20,9 +20,18 @@ ad-joc-layout = 7.1
# Binaural rendering mode: near | mid | far.
ad-joc-mode = mid
# Rosella input only: which filterbank the renderer uses. 1 = the public bank
# (13 taps / 6 slots, the default), 2 = the captured bank (11 taps / 3 slots)
# that matches the reference renderer. Ignored for SOFA and .jochrtf input.
ad-joc-rosella-filterbank = 1
# Extra gain in dB (-60 .. 12).
ad-joc-gain-db = 0
# Quantise the output to the renderer's 24-bit rule (the same truncation
# the renderer's own frontends deliver in int24 mode). Off = plain float32.
ad-joc-int24 = no
# Android: there is no executable directory to search, so ad-joc-hrtf must be
# a full path the app can read.
# ad-joc-hrtf = /sdcard/Download/binaural.sofa