fix(android): add ProGuard rules to suppress HMS missing class errors

R8 fails on missing optional HMS dependencies (HiAnalytics, libcore,
BouncyCastle). Add dontwarn rules and wire proguard-rules.pro to release
build type.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-03-10 08:22:11 -07:00
parent 62f1a88557
commit 61e7533d64
2 changed files with 22 additions and 0 deletions

View File

@ -79,6 +79,11 @@ android {
// TODO: Add your own signing config for the release build. // TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works. // Signing with the debug keys for now, so `flutter run --release` works.
signingConfig = signingConfigs.getByName("debug") signingConfig = signingConfigs.getByName("debug")
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
} }
} }

17
it0_app/android/app/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,17 @@
# Flutter
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.** { *; }
-keep class io.flutter.util.** { *; }
-keep class io.flutter.view.** { *; }
-keep class io.flutter.** { *; }
-keep class io.flutter.plugins.** { *; }
# Huawei HMS optional internal classes not bundled in the app
-dontwarn com.huawei.android.os.**
-dontwarn com.huawei.hianalytics.**
-dontwarn com.huawei.hms.availableupdate.**
-dontwarn com.huawei.libcore.io.**
-dontwarn com.huawei.secure.android.**
# BouncyCastle referenced by HMS security but not shipped
-dontwarn org.bouncycastle.**