Chuyển đến nội dung chính

第 22 課:發佈到 App Store 和 Google Play

Google Play Console:清單、螢幕截圖、發布曲目。 App Store Connect:元資料、TestFlight。應用程式審查指南。版本控制策略,分階段推出。發布後監控。

💻 程式設計 — 第 22 課 第 22 課:發佈到 App Store 和 Google 玩

Flutter 和 Dart:從基礎到高級

第 6 部分:測試、CI/CD 和生產

亞洲開發網

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_splashflutter_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:從基礎到高級! 🎉