fix: enable code shrinking and add ProGuard rules for ML Kit text recognition

This commit is contained in:
Lukas Müllner 2026-02-24 08:00:09 +01:00
parent 91f25e0cef
commit f62eb9f288
2 changed files with 13 additions and 0 deletions

View file

@ -35,6 +35,12 @@ android {
// 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")
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
}

7
android/app/proguard-rules.pro vendored Normal file
View file

@ -0,0 +1,7 @@
# Google ML Kit text recognition keep all script-specific recognizer classes
-keep class com.google.mlkit.vision.text.** { *; }
-keep class com.google.mlkit.vision.text.chinese.** { *; }
-keep class com.google.mlkit.vision.text.devanagari.** { *; }
-keep class com.google.mlkit.vision.text.japanese.** { *; }
-keep class com.google.mlkit.vision.text.korean.** { *; }
-dontwarn com.google.mlkit.vision.text.**