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

Bài 22: Publish lên App Store & Google Play

Google Play Console: listing, screenshots, release tracks. App Store Connect: metadata, TestFlight. App review guidelines. Versioning strategy, staged rollout. Post-launch monitoring.

💻 Lập trình — Bài 22 Bài 22: Publish lên App Store & Google Play

Flutter & Dart: Từ Cơ bản đến Nâng cao

Phần 6: Testing, CI/CD & Production

xdev.asia

1. Chuẩn bị trước khi Publish

# 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
ChecklistAndroidiOS
App iconAdaptive icon các size1024x1024 + các size
Splash screenflutter_native_splashflutter_native_splash
PermissionsAndroidManifest.xmlInfo.plist
ProGuardproguard-rules.proN/A
SigningKeystore + key.propertiesCertificates + Profiles

2. Google Play Console

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

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 & Staged Rollout

// 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. Post-Launch Monitoring

// 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())),
  );
}

Chúc mừng bạn đã hoàn thành series Flutter & Dart: Từ Cơ bản đến Nâng cao! 🎉