From 91a622733cf4501f903459f934888c5c64641ffb Mon Sep 17 00:00:00 2001 From: Zhou Weidong <502333560@qq.com> Date: Wed, 21 Oct 2026 19:10:05 +0800 Subject: [PATCH] =?UTF-8?q?build(android):=20=E7=94=9F=E4=BA=A7=E5=8C=85?= =?UTF-8?q?=20abiFilters=20=E4=BB=85=E4=BF=9D=E7=95=99=20arm64-v8a=20?= =?UTF-8?q?=E4=B8=8E=20armeabi-v7a?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 ++- android/app/build.gradle.kts | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 076cf36..0de2ae1 100644 --- a/README.md +++ b/README.md @@ -151,8 +151,9 @@ flutter build apk --release --target-platform android-arm64,android-arm 说明: +- `android/app/build.gradle.kts` 的 `release` 已配置 `abiFilters`,只保留 `arm64-v8a` 与 `armeabi-v7a`,插件也不会再带入 `x86_64` 原生库。 - `x86_64` 只用于模拟器,不进入生产包。 -- 不要直接运行 `flutter build apk --release`:默认会把 `arm64-v8a`、`armeabi-v7a`、`x86_64` 三套原生库都打进去,包体约 57MB。 +- 不要直接运行 `flutter build apk --release`:默认会编译三套原生库,包体约 57MB。 - 只有需要进一步压缩单机下载体积时,才考虑 `--split-per-abi` 出分架构包(arm64 约 21MB、armv7 约 19MB),默认不用。 ## 门禁 diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index f370e70..799ffb2 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -29,6 +29,10 @@ android { buildTypes { release { + // 生产包只保留 arm64-v8a 与 armeabi-v7a,避免插件带入 x86_64 原生库 + ndk { + abiFilters += listOf("arm64-v8a", "armeabi-v7a") + } // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. signingConfig = signingConfigs.getByName("debug")