02-build-configuration.md
AI Agent Target: Defines Android build specifications, environment variables passed during compilation, and code signing configurations.
Human Target: 設定 Android 編譯、傳遞環境變數與管理發布簽章的詳細資訊。
android/app/build.gradle.kts)Android 應用程式需要特定設定以支援本地 AI 模型 (LiteRT-LM) 與付費模組 (RevenueCat v10)。
30 (LiteRT-LM 與 RevenueCat 強制要求)。28.2.13676358 (確保 SQLite 的 C++ 編譯穩定)。VERSION_17
isMinifyEnabled = true
isShrinkResources = true
proguard-rules.pro
--dart-define 環境變數編譯期變數可確保 API 金鑰不直接寫入原始碼中。
完整清單:
FIREBASE_API_KEY
SUPABASE_URL
SUPABASE_ANON_KEY
POWERSYNC_URL
REVENUECAT_APPLE_API_KEY
REVENUECAT_GOOGLE_API_KEY
透過 PowerShell 範例:
flutter build apk --dart-define=FIREBASE_API_KEY="your_key"
key.properties 格式storePassword=<password>
keyPassword=<password>
keyAlias=upload
storeFile=../keystore/upload-keystore.jks
使用 keytool 產生用於發布簽章的 upload-keystore.jks,並放於 android/keystore/ 目錄。