Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

fix: keep Play Android packages arm64-only

tianma-iffbc0141a0775
diff --git a/.env.android.local.example b/.env.android.local.example
index e3e2cfbf..74c3f5e0 100644
--- a/.env.android.local.example
+++ b/.env.android.local.example
@@ -5,5 +5,5 @@ ANDROID_KEYSTORE_PASSWORD=
ANDROID_KEY_ALIAS=
ANDROID_KEY_PASSWORD=
-# Optional. The default includes all Play-supported Android architectures.
-EDGE_EVER_ANDROID_ARCHS=armeabi-v7a,arm64-v8a,x86,x86_64
+# Optional. Play builds default to arm64-v8a for compact Play-signed Release APKs.
+EDGE_EVER_ANDROID_PLAY_ARCHS=arm64-v8a
diff --git a/.github/workflows/store-delivery.yml b/.github/workflows/store-delivery.yml
index 1c7cd37e..b31e02c3 100644
--- a/.github/workflows/store-delivery.yml
+++ b/.github/workflows/store-delivery.yml
@@ -151,6 +151,7 @@ jobs:
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
+ EDGE_EVER_ANDROID_PLAY_ARCHS: arm64-v8a
run: bun run build:android:play
- name: Preserve Play bundle and deobfuscation mapping
@@ -193,6 +194,14 @@ jobs:
EDGE_EVER_ANDROID_ALLOWED_SIGNER_SHA256: ${{ secrets.ANDROID_PLAY_APP_SIGNER_SHA256 }}
run: node scripts/verify-android-apk-signature.mjs "$apk_path"
+ - name: Verify Play APK architecture
+ run: |
+ actual_archs="$(unzip -Z1 "$apk_path" | sed -n 's#^lib/\([^/]*\)/.*#\1#p' | sort -u | paste -sd, -)"
+ if [[ "$actual_archs" != "arm64-v8a" ]]; then
+ echo "::error::Expected an arm64-v8a Play APK, received: ${actual_archs:-no native libraries}."
+ exit 1
+ fi
+
- name: Replace GitHub Release APK with the Play-signed build
env:
GH_TOKEN: ${{ github.token }}
diff --git a/docs/mobile-build.md b/docs/mobile-build.md
index e9c76d04..50d74500 100644
--- a/docs/mobile-build.md
+++ b/docs/mobile-build.md
@@ -58,8 +58,9 @@ SHA-256 to
`22bf52a9501c89020f5acc966960152c826bfa64f31e578e858d088f8cd75d87`.
Any other signer fails the build. Verify the application version and APK
SHA-256 as well. Additional ABIs should only be published for an explicit
-compatibility need; the Play AAB continues to include all supported
-architectures. A release whose audited change range affects mobile runtime
+compatibility need. The Play AAB is also intentionally limited to
+`arm64-v8a`, so its Play-signed universal APK remains a single-ABI download.
+A release whose audited change range affects mobile runtime
code, shared code used by mobile, mobile dependencies, native configuration,
APK build tooling, or signer verification must rebuild the APK from that
release commit.
@@ -77,9 +78,9 @@ verification.
This locally signed APK prepares the Draft without requiring a Google Play
submission. After the matching AAB is delivered, the store-delivery workflow
downloads Google Play's signed universal APK and replaces the GitHub Release
-asset under the established filename. The Play-generated APK supports arm64
-and may contain additional ABIs; publishing it is the explicit compatibility
-exception that lets Play and GitHub installations update each other without
+asset under the established filename. Because the uploaded AAB contains only
+`arm64-v8a`, the Play-generated APK also remains arm64-only. Publishing the
+Play-signed APK lets Play and GitHub installations update each other without
uninstalling the app. The workflow pins and verifies the Play app-signing
certificate before replacing the asset.
@@ -109,11 +110,13 @@ apps/mobile/android/app/build/outputs/bundle/release/app-release.aab
apps/mobile/android/app/build/outputs/mapping/release/mapping.txt
```
-The command builds all Play-supported Android architectures by default,
-verifies the AAB signature, and requires a non-empty R8 mapping file. Keep an
-encrypted backup of `signing.env` and the upload keystore outside the
-repository. Do not replace or regenerate the upload key for an existing Play
-app unless the key reset has been completed in Play Console.
+The command builds `arm64-v8a` by default, verifies the AAB signature, and
+requires a non-empty R8 mapping file. This keeps the Play-generated universal
+APK suitable for the arm64 GitHub Release asset instead of bundling unused
+32-bit ARM and x86 native libraries. Keep an encrypted backup of `signing.env`
+and the upload keystore outside the repository. Do not replace or regenerate
+the upload key for an existing Play app unless the key reset has been completed
+in Play Console.
Set `EDGE_EVER_ANDROID_ENV_FILE` to use a different secure environment file.
diff --git a/docs/store-delivery.md b/docs/store-delivery.md
index 3e8d0213..d25c905e 100644
--- a/docs/store-delivery.md
+++ b/docs/store-delivery.md
@@ -82,16 +82,16 @@ Use `--dry-run` to print the GitHub workflow dispatch without starting it.
### Google Play
-The self-hosted release runner builds a signed AAB from the selected tag,
-verifies its signature and R8 mapping, preserves both as GitHub Actions
-artifacts, and uploads the AAB through EAS Submit.
+The self-hosted release runner builds an `arm64-v8a` signed AAB from the
+selected tag, verifies its signature and R8 mapping, preserves both as GitHub
+Actions artifacts, and uploads the AAB through EAS Submit.
After Google Play finishes processing the bundle, the workflow downloads the
Play-signed universal APK, verifies the pinned app-signing certificate, and
replaces the GitHub Release Android asset. This makes installations from
-Google Play and GitHub mutually updateable. The established `arm64-v8a` asset
-name is retained for release compatibility; the Play-generated universal APK
-supports arm64 and can include additional ABIs.
+Google Play and GitHub mutually updateable. The uploaded AAB is intentionally
+limited to `arm64-v8a`, so the Play-generated universal APK does not bundle
+unused 32-bit ARM or x86 native libraries.
Internal, Alpha, Beta, and Production profiles use a completed release on the
selected track. The default command targets Production; use
diff --git a/docs/store-delivery.zh-CN.md b/docs/store-delivery.zh-CN.md
index f596fdb0..6287ddb1 100644
--- a/docs/store-delivery.zh-CN.md
+++ b/docs/store-delivery.zh-CN.md
@@ -77,13 +77,15 @@ bun run publish:stores -- \
### Google Play
-自托管发布 Runner 会从指定 tag 构建签名 AAB,验证签名和 R8 Mapping,将两者
-保留为 GitHub Actions Artifacts,然后通过 EAS Submit 上传 AAB。
+自托管发布 Runner 会从指定 tag 构建仅含 `arm64-v8a` 的签名 AAB,验证签名和
+R8 Mapping,将两者保留为 GitHub Actions Artifacts,然后通过 EAS Submit 上传
+AAB。
Google Play 处理完 AAB 后,工作流会下载由 Play 应用签名密钥签名的通用 APK,
核对固定的应用签名证书,并替换 GitHub Release 中的 Android 资产。这样从 Play
-和 GitHub 安装的版本可以互相覆盖升级。为保持 Release 兼容性,资产继续沿用
-`arm64-v8a` 文件名;Play 生成的通用 APK 支持 arm64,也可能包含其他 ABI。
+和 GitHub 安装的版本可以互相覆盖升级。上传的 AAB 会明确限制为
+`arm64-v8a`,因此 Play 生成的通用 APK 不会再打包无用的 32 位 ARM 或 x86
+原生库。
Internal、Alpha、Beta 和 Production 配置都会在所选轨道创建 Completed
Release。默认命令直接使用 Production;只有明确要求测试交付时才使用
diff --git a/scripts/build-android-local.sh b/scripts/build-android-local.sh
index 94275a7c..6409b85c 100755
--- a/scripts/build-android-local.sh
+++ b/scripts/build-android-local.sh
@@ -82,7 +82,7 @@ COMMON_ARGS=(
: "${ANDROID_KEY_ALIAS:?请设置 ANDROID_KEY_ALIAS}"
: "${ANDROID_KEY_PASSWORD:?请设置 ANDROID_KEY_PASSWORD}"
-PLAY_ARCHS="${EDGE_EVER_ANDROID_ARCHS:-armeabi-v7a,arm64-v8a,x86,x86_64}"
+PLAY_ARCHS="${EDGE_EVER_ANDROID_PLAY_ARCHS:-arm64-v8a}"
APK_ARCHS="${EDGE_EVER_ANDROID_APK_ARCHS:-arm64-v8a}"
KEYSTORE_FILE="$(cd "$(dirname "$ANDROID_KEYSTORE_FILE")" && pwd)/$(basename "$ANDROID_KEYSTORE_FILE")"
APK_PATH="$ANDROID_DIR/app/build/outputs/apk/release/app-release.apk"
@@ -143,7 +143,14 @@ run_timed "Gradle 生产 AAB 构建" ./gradlew bundleRelease \
-Pandroid.injected.signing.key.password="$ANDROID_KEY_PASSWORD" \
-Pandroid.injected.signing.store.type=PKCS12
-run_timed "校验 AAB 签名" jarsigner -verify app/build/outputs/bundle/release/app-release.aab
+AAB_PATH="app/build/outputs/bundle/release/app-release.aab"
+ACTUAL_PLAY_ARCHS="$(unzip -Z1 "$AAB_PATH" | sed -n 's#^base/lib/\([^/]*\)/.*#\1#p' | sort -u | paste -sd, -)"
+if [[ "$ACTUAL_PLAY_ARCHS" != "$PLAY_ARCHS" ]]; then
+ echo "AAB 架构不符合预期:期望 ${PLAY_ARCHS},实际 ${ACTUAL_PLAY_ARCHS:-无原生库}。" >&2
+ exit 1
+fi
+
+run_timed "校验 AAB 签名" jarsigner -verify "$AAB_PATH"
test -s app/build/outputs/mapping/release/mapping.txt
-echo "完成: $ANDROID_DIR/app/build/outputs/bundle/release/app-release.aab"
+echo "完成: $ANDROID_DIR/$AAB_PATH"
echo "反混淆文件: $ANDROID_DIR/app/build/outputs/mapping/release/mapping.txt"
diff --git a/scripts/store-delivery.test.mjs b/scripts/store-delivery.test.mjs
index 4a7b9551..21547324 100644
--- a/scripts/store-delivery.test.mjs
+++ b/scripts/store-delivery.test.mjs
@@ -53,4 +53,27 @@ describe("store delivery command", () => {
expect(workflow).toContain("scripts/download-play-universal-apk.mjs");
expect(workflow).toContain('gh release upload "$RELEASE_TAG" "$apk_path"');
});
+
+ test("keeps the Play bundle and generated Release APK arm64-only", () => {
+ const workflow = readFileSync(
+ new URL("../.github/workflows/store-delivery.yml", import.meta.url),
+ "utf8",
+ );
+ const buildScript = readFileSync(
+ new URL("./build-android-local.sh", import.meta.url),
+ "utf8",
+ );
+
+ expect(workflow).toContain("EDGE_EVER_ANDROID_PLAY_ARCHS: arm64-v8a");
+ expect(workflow).toContain("Verify Play APK architecture");
+ expect(workflow).toContain('if [[ "$actual_archs" != "arm64-v8a" ]]');
+ expect(buildScript).toContain(
+ 'PLAY_ARCHS="${EDGE_EVER_ANDROID_PLAY_ARCHS:-arm64-v8a}"',
+ );
+ expect(buildScript).toContain(
+ 'if [[ "$ACTUAL_PLAY_ARCHS" != "$PLAY_ARCHS" ]]',
+ );
+ expect(buildScript).not.toContain("EDGE_EVER_ANDROID_ARCHS:-");
+ expect(buildScript).not.toContain("armeabi-v7a,arm64-v8a,x86,x86_64");
+ });
});