perf(android): shrink the release APK

This commit is contained in:
Erwan Leboucher committed 2026-09-19 23:54:58 +02:00
1 parent 7b6afc0f54
commit 8bb20688a2
5 files changed
+23 -7

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
default: patch
---
Shrink the Android APK: strip the native library, drop bundled source maps, and split the F-Droid build per ABI.
+9 -6
View File
@@ -326,7 +326,7 @@ jobs:
echo "storeFile=$RUNNER_TEMP/keystore.jks" >> keystore.properties
# Must run before the Google build: they share one Gradle output directory.
- name: Build FOSS Android APK
- name: Build FOSS Android APKs
if: ${{ env.IS_RELEASE == 'true' }}
shell: bash
env:
@@ -335,13 +335,16 @@ jobs:
# tauri-build validates every file in capabilities/, so the geolocation
# permissions must be absent, not just unreferenced.
rm src-tauri/capabilities/geolocation.json
pnpm tauri android build --apk --target aarch64 armv7 -- --no-default-features --features wry,matrix-crypto
pnpm tauri android build --apk --split-per-abi --target aarch64 armv7 -- --no-default-features --features wry,matrix-crypto
git checkout -- src-tauri/capabilities/geolocation.json
OUT='src-tauri/gen/android/app/build/outputs/apk/universal/release'
APK=$(find "$OUT" -name '*.apk' -type f | head -1)
[ -n "$APK" ] || { echo 'FOSS APK not found' >&2; exit 1; }
mkdir -p android-artifacts
mv "$APK" "android-artifacts/Sable-${VERSION}-android-universal-foss.apk"
for pair in 'arm64:arm64' 'arm:armv7'; do
FLAVOR=${pair%%:*}
ABI=${pair##*:}
APK=$(find "src-tauri/gen/android/app/build/outputs/apk/$FLAVOR/release" -name '*.apk' -type f | head -1)
[ -n "$APK" ] || { echo "FOSS $ABI APK not found" >&2; exit 1; }
mv "$APK" "android-artifacts/Sable-${VERSION}-android-${ABI}-foss.apk"
done
- name: Build Android bundles
shell: bash
+5
View File
@@ -243,3 +243,8 @@ tauri-typegen = { git = "https://github.com/SableClient/tauri-typegen", branch =
# tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "feat/cef" }
# tauri-plugin-single-instance = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "feat/cef" }
# tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "feat/cef" }
[profile.release]
strip = "symbols"
lto = "thin"
codegen-units = 1
@@ -58,6 +58,9 @@ android {
getByName("release") {
signingConfig = signingConfigs.getByName("release")
isMinifyEnabled = true
packaging {
jniLibs.useLegacyPackaging = true
}
proguardFiles(
*fileTree(".") { include("**/*.pro") }
.plus(getDefaultProguardFile("proguard-android-optimize.txt"))
+1 -1
View File
@@ -80,7 +80,7 @@ const callEmbeddedDir = 'node_modules/@sableclient/sable-call-embedded/dist';
const copyFiles = {
targets: [
{
src: callEmbeddedDir,
src: [callEmbeddedDir, `!${callEmbeddedDir}/**/*.map`],
dest: 'public/element-call',
rename: { stripBase: callEmbeddedDir.split('/').length },
},