Skip to content

Unofficial YouTube Music / Spotify Premium client for Android, built in Liquid Glass. Audio effects, Spotify Connect, listening history, 8 languages. Rust core on librespot.

Square installs on 32-bit phones too

Lelonio7764e17b03b7
diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml
index d45cf62..1b7fea8 100644
--- a/.github/actions/setup/action.yml
+++ b/.github/actions/setup/action.yml
@@ -32,7 +32,8 @@ runs:
- name: Rust
shell: bash
run: |
- rustup toolchain install stable --profile minimal --target aarch64-linux-android
+ rustup toolchain install stable --profile minimal \
+ --target aarch64-linux-android --target armv7-linux-androideabi
rustup default stable
# The Rust core is most of a cold build. Keyed on the lock file and the
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 2a33209..75dac81 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -32,6 +32,6 @@ jobs:
- uses: actions/upload-artifact@v7
with:
name: square-dev-${{ github.sha }}
- path: app/build/outputs/apk/dev/app-dev.apk
+ path: app/build/outputs/apk/dev/app-universal-dev.apk
retention-days: 14
if-no-files-found: error
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 4114cac..55201ce 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,6 +1,7 @@
name: Release
-# A tag like v2.2.4 builds the signed APK and leaves it on a draft release.
+# A tag like v2.2.4 builds the signed APKs and leaves them on a draft release:
+# one per ABI and a universal one.
# The notes are still written by hand, and publishing the draft is still a
# person's decision. Run by hand, it builds and signs the same way but only
# keeps the APK as an artifact, which is how the setup can be tried without
@@ -71,36 +72,45 @@ jobs:
# whichever is newest on the runner, and what it prints is shown: a
# certificate is public, anyone can read it off the APK, and the first
# run failed here with nothing to go on.
+ #
+ # Every split is checked, and copied under the name the app's updater
+ # looks for: it picks the one naming the phone's ABI, then "universal".
- name: Check the signature
run: |
set -o pipefail
- apk=app/build/outputs/apk/release/app-release.apk
- certs=$("$ANDROID_HOME/build-tools/36.0.0/apksigner" verify --print-certs "$apk")
- echo "$certs"
- digest=$(echo "$certs" | sed -n 's/^Signer.*certificate SHA-256 digest: //p' | head -n 1)
- if [ "$digest" != "9f3469d5049fa93e6b63effd1ad10a1913c9a65b0f7c9a5f2f770cd8ea27cf0c" ]; then
- echo "::error::signed with ${digest:-nothing}, not the release key"
- exit 1
- fi
- cp "$apk" "square-${{ steps.version.outputs.name }}.apk"
+ for abi in arm64-v8a armeabi-v7a universal; do
+ apk=app/build/outputs/apk/release/app-$abi-release.apk
+ certs=$("$ANDROID_HOME/build-tools/36.0.0/apksigner" verify --print-certs "$apk")
+ echo "$certs"
+ digest=$(echo "$certs" | sed -n 's/^Signer.*certificate SHA-256 digest: //p' | head -n 1)
+ if [ "$digest" != "9f3469d5049fa93e6b63effd1ad10a1913c9a65b0f7c9a5f2f770cd8ea27cf0c" ]; then
+ echo "::error::$abi signed with ${digest:-nothing}, not the release key"
+ exit 1
+ fi
+ cp "$apk" "square-${{ steps.version.outputs.name }}-$abi.apk"
+ done
- name: Draft release
if: github.ref_type == 'tag'
env:
GH_TOKEN: ${{ github.token }}
+ # arm64 first, and on its own: the updater in 2.4.2 and earlier takes
+ # the first APK it finds, every phone that has one of those is 64-bit,
+ # and gh uploads several files at once in no fixed order.
run: |
- apk="square-${{ steps.version.outputs.name }}.apk"
+ name="square-${{ steps.version.outputs.name }}"
if gh release view "$GITHUB_REF_NAME" > /dev/null 2>&1; then
- gh release upload "$GITHUB_REF_NAME" "$apk" --clobber
+ gh release upload "$GITHUB_REF_NAME" "$name-arm64-v8a.apk" --clobber
else
- gh release create "$GITHUB_REF_NAME" "$apk" --draft \
+ gh release create "$GITHUB_REF_NAME" "$name-arm64-v8a.apk" --draft \
--title "${{ steps.version.outputs.name }}" --notes ""
fi
+ gh release upload "$GITHUB_REF_NAME" "$name-armeabi-v7a.apk" "$name-universal.apk" --clobber
- uses: actions/upload-artifact@v7
if: github.ref_type != 'tag'
with:
name: square-${{ steps.version.outputs.name }}-signed
- path: square-${{ steps.version.outputs.name }}.apk
+ path: square-${{ steps.version.outputs.name }}-*.apk
retention-days: 7
if-no-files-found: error
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index f1447ad..65f8576 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -14,7 +14,7 @@ plugins {
* extra Rust build (~2 min from cold), so the default is deliberately just the
* one. Add "x86_64" for the emulator and "armeabi-v7a" for pre-2015 hardware.
*/
-val nativeAbis = listOf("arm64-v8a")
+val nativeAbis = listOf("arm64-v8a", "armeabi-v7a")
/** NDK used for both AGP and the Cargo cross-build; keep the two in step. */
val ndkVersionForCargo = "28.2.13676358"
@@ -54,8 +54,24 @@ android {
versionName = "2.4.2"
buildConfigField("boolean", "VERBOSE_LOG", "false")
- ndk {
- abiFilters += nativeAbis
+ // Bungee only for the ABIs that ship; see the splits below.
+ externalNativeBuild {
+ cmake {
+ abiFilters += nativeAbis
+ }
+ }
+ }
+
+ // One APK per ABI, and a universal one for whoever does not know which
+ // their phone is. The split sets the ABIs, so the NDK filter it would
+ // conflict with is not set; CMake is told the same list, or it would build
+ // Bungee for ABIs nothing ships.
+ splits {
+ abi {
+ isEnable = true
+ reset()
+ include(*nativeAbis.toTypedArray())
+ isUniversalApk = true
}
}
@@ -163,6 +179,10 @@ android {
// The Rust cdylib is already stripped by the release profile; letting
// Gradle re-strip it with the wrong tool breaks the arm64 build.
jniLibs.keepDebugSymbols += "**/libsquarecore.so"
+ // The universal APK would otherwise carry the x86 builds some
+ // dependencies ship, without the Rust core: installable on an x86
+ // device, and closing at once there.
+ jniLibs.excludes += listOf("lib/x86/**", "lib/x86_64/**")
}
}
diff --git a/app/src/main/java/dev/lelonio/square/update/Updater.kt b/app/src/main/java/dev/lelonio/square/update/Updater.kt
index 5061cb3..6ffc69d 100644
--- a/app/src/main/java/dev/lelonio/square/update/Updater.kt
+++ b/app/src/main/java/dev/lelonio/square/update/Updater.kt
@@ -137,9 +137,19 @@ class Updater(context: Context) {
val body = json.parseToJsonElement(response.body?.string().orEmpty()) as? JsonObject
?: return null
val tag = body["tag_name"]?.jsonPrimitive?.content?.removePrefix("v") ?: return null
- val asset = (body["assets"] as? JsonArray)
+ val apks = (body["assets"] as? JsonArray)
?.filterIsInstance<JsonObject>()
- ?.firstOrNull { it["name"]?.jsonPrimitive?.content?.endsWith(".apk") == true }
+ ?.filter { it["name"]?.jsonPrimitive?.content?.endsWith(".apk") == true }
+ .orEmpty()
+ // One APK per ABI and a universal one: the phone's own first, in
+ // the order it prefers them, then the universal, then whatever
+ // there is, for a release that ships a single APK.
+ fun named(part: String) = apks.firstOrNull {
+ it["name"]?.jsonPrimitive?.content?.contains(part) == true
+ }
+ val asset = android.os.Build.SUPPORTED_ABIS.firstNotNullOfOrNull(::named)
+ ?: named("universal")
+ ?: apks.firstOrNull()
?: return null
val url = asset["browser_download_url"]?.jsonPrimitive?.content ?: return null
val size = asset["size"]?.jsonPrimitive?.content?.toLongOrNull() ?: 0L