Commit Graph
9 Commits
Author SHA1 Message Date
TheM14 e5954169b2 Sign Android APKs with a fixed repository keystore
The Android workflow generated a new throwaway keystore on every run, so
every APK had a different signature and Android refused to install it over
the previous build.

Load the release keystore from ANDROID_KEYSTORE_BASE64, validate it with
keytool, and sign assembleRelease with the PKCS12 store type plus
ANDROID_KEYSTORE_PASSWORD, ANDROID_KEY_ALIAS and ANDROID_KEY_PASSWORD.
Fail the build when any secret is missing instead of falling back to a
random key, and remove the temporary keystore afterwards.

Document the one-time keystore and secret setup, and ignore *.jks and
*.keystore so private keys cannot be committed.

The first fixed-signature APK needs one uninstall because the installed APK
was signed by the old throwaway key; later builds install as updates.
2026-11-13 18:21:41 +08:00
TheM14 0b94c75fd6 Match the packaged libraries line by line in the APK check
The listing comes from unzip -l, so entries are newline separated; the
glob compare used spaces and reported every library as missing even
though the APK was complete.
2026-10-31 04:07:47 +08:00
TheM14 f371dc0224 Do not source path.sh when building the JNI bridge
path.sh reads $cores before setting it, which aborts under set -u; the
step only needs depinfo.sh for the NDK version, and ndk-build is told
the job count directly.
2026-10-31 03:57:58 +08:00
TheM14 5ddbd6154b Build the JNI bridge for the Android app
The app's MPVLib loads libplayer.so before libmpv, and mpv-android builds
that bridge with ndk-build over app/src/main/jni, installing it and the
prebuilt ffmpeg/mpv objects into app/src/main/libs/<abi>. The workflow
only built the mpv target and then ran Gradle, so the APK shipped
without libplayer.so and every playback died with UnsatisfiedLinkError.

Run ndk-build the way buildscripts/scripts/mpv-android.sh does, and write
ndk.properties, which the Gradle build needs to find the NDK for symbol
stripping (the previous APK carried 134 MB of unstripped libraries).
2026-10-31 03:52:57 +08:00
TheM14 8673a3b762 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.
2026-10-31 03:33:27 +08:00
TheM14 8ed49a1170 Locate the Android SDK and the library directory the way the build
system lays them out

download-sdk.sh unpacks the SDK as buildscripts/sdk/android-sdk-linux,
and mpv-android keeps the libraries in app/src/main/libs with jniLibs
pointing at it. Check those names first, fall back to a platforms/
search, and write the libraries into libs/<abi> while recreating the
alias.
2026-10-31 03:05:03 +08:00
TheM14 68fc020260 Replace the dangling jniLibs link before copying the libraries
mpv-android ships app/src/main/jniLibs as a symlink for the ABI its own
build wants, so mkdir -p fails with "File exists" when the link target
does not exist. Replace the link (or file) with a plain directory and
copy the three libraries into arm64-v8a/.
2026-10-31 02:55:20 +08:00
TheM14 c45808135d 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.
2026-10-31 02:47:40 +08:00
TheM14 9a9bb7b0c8 Add android test build file and fix windows build file 2026-10-18 21:59:32 +08:00