1. 發布前的準備
# pubspec.yaml
name: my_app
description: A Flutter application
version: 1.0.0+1 # version_name + version_code
flutter:
uses-material-design: true
assets:
- assets/images/
- assets/icons/
# Build release
flutter build appbundle --release # Android AAB
flutter build ipa --release # iOS IPA
# Verify APK size
flutter build apk --analyze-size
| 清單 | 安卓 | iOS系統 |
|---|---|---|
| 應用程式圖標 | 所有尺寸的自適應圖標 | 1024x1024 + 尺寸 |
| 啟動畫面 | flutter_native_splash | flutter_native_splash |
| 權限 | AndroidManifest.xml | 資訊表 |
| 混淆衛士 | proguard-rules.pro | 不適用 |
| 簽約 | 金鑰庫 + key.properties | 證書+簡介 |
2. 谷歌遊戲控制台
Google Play Console workflow:
1. Tạo app: All apps → Create app
2. Store listing:
- Title, Short description, Full description
- Screenshots: phone (2+), tablet, TV nếu có
- Feature graphic: 1024x500
- App icon: 512x512
3. App content:
- Privacy policy URL
- Content rating questionnaire
- Target audience
- Data safety form
4. Release:
- Internal testing → Closed testing → Open testing → Production
- Upload AAB file
- Release notes cho mỗi version
5. Pricing & Distribution: Free/Paid, countries
3.應用程式商店連接
App Store Connect workflow:
1. Tạo app: My Apps → (+) New App
- Bundle ID matching Xcode
- SKU unique
2. App Information:
- Name, subtitle, category
- Privacy policy URL
- Age rating
3. Prepare for Submission:
- Screenshots: 6.7", 6.5", 5.5" iPhone + iPad
- Description, keywords, support URL
- Build: upload từ Xcode hoặc Transporter
4. TestFlight:
- Internal testing (25 testers max)
- External testing (10,000 testers)
5. Submit for Review
4. 版本控制和分階段部署
// Versioning strategy
// pubspec.yaml version format: MAJOR.MINOR.PATCH+BUILD_NUMBER
// Ví dụ: 1.2.3+45
// Auto-increment build number trong CI
// flutter build apk --build-number=$GITHUB_RUN_NUMBER
# Android staged rollout
# Google Play Console → Release → Production
# Rollout percentage: 5% → 20% → 50% → 100%
# iOS phased release
# App Store Connect → Version → Phased Release
# 1% → 2% → 5% → 10% → 20% → 50% → 100% (7 ngày)
5. 啟動後監控
// Firebase Crashlytics — theo dõi crashes
// Firebase Analytics — user behavior
// Firebase Performance — app performance
// Sentry alternative
import 'package:sentry_flutter/sentry_flutter.dart';
Future<void> main() async {
await SentryFlutter.init(
(options) {
options.dsn = 'https://[email protected]/project';
options.tracesSampleRate = 0.2;
options.environment = 'production';
},
appRunner: () => runApp(const ProviderScope(child: MyApp())),
);
}
恭喜您完成系列 Flutter 和 Dart:從基礎到高級! 🎉