0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Flutter × Shorebird で「ストア不要」のパッチ配信を体験する(Android版)

Last updated at Posted at 2025-08-27

はじめに

アプリ開発をしているとこの文言だけ修正したいのに、アプリを審査が...という時ありますよね。この記事では Shorebird を使って、ストア公開なしでパッチ配信し、次回起動で反映させる方法を試します(Android)。

Shorebirdで、できること、できないこと

できること

  • ストア審査なしでDartコードの変更を配信(UIテキスト・色・ロジックなど)し、次回起動で反映
  • Dartのみの依存パッケージの追加/更新(ネイティブを含まないものに限る)
  • リリース版ごとにパッチを作成・適用
  • 問題パッチのロールバック(コンソールから対象パッチを取り消し、前の状態へ戻せる)

できないこと / 注意点

  • アセット(画像・フォント・音声等)の更新は不可
  • ネイティブコード(Kotlin/Java/Swift/Obj-C)の変更や、ネイティブを含む依存の更新は不可。Flutterエンジンの変更も不可
  • アプリ再起動なしに即時適用は不可。起動中にDLし、次の起動で適用される

ゴール

  • flutter create の初期アプリに Shorebird を導入
  • 最初のリリース(release) を作って端末に入れる(プレビュー)
  • タイトル/背景色を変更 → パッチ作成 → 再起動で更新内容をビルドすることなく反映 を確認

前提

  • macOS / Android
  • Flutter(stable)とAndroid SDKが使えること
  • エミュレータ or 実機が接続できること
  • Shorebird アカウント(無料可)

実施した環境

$flutter doctor -v
[✓] Flutter (Channel stable, 3.32.2, on macOS 15.3.1 24D70 darwin-arm64, locale ja-JP) [464ms]
    • Flutter version 3.32.2 on channel stable at .asdf/installs/flutter/3.32.2-stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 8defaa71a7 (3 months ago), 2025-06-04 11:02:51 -0700
    • Engine revision 1091508939
    • Dart version 3.8.1
    • DevTools version 2.45.1

試してみる

0) Shorebird CLI を入れる & ログイン

インストール

$ curl --proto '=https' --tlsv1.2 https://raw.githubusercontent.com/shorebirdtech/install/main/install.sh -sSf | bash

PATHが通ってない場合は ~/.shorebird/bin をシェルのPATHに追加

$ shorebird --version
$ shorebird doctor
$ shorebird login
$ shorebird doctor 
Updating Flutter...

...

URL Reachability
✓ https://api.shorebird.dev OK (0.2s)
✓ https://console.shorebird.dev OK (0.6s)
✓ https://oauth2.googleapis.com OK (0.1s)
✓ https://storage.googleapis.com OK (83ms)
✓ https://cdn.shorebird.cloud OK (75ms)

✓ Shorebird is up-to-date (1.1s)
✓ AndroidManifest.xml files contain INTERNET permission (24ms)
✓ macOS app has correct entitlements (2ms)
✓ shorebird.yaml found in pubspec.yaml assets (2ms)
✓ Lock files are tracked in source control (8ms)

No issues detected!

1) 初期Flutterアプリを作る

$ flutter create shorebird_demo
$ cd shorebird_demo
$ flutter run   

初期アプリが起動しました。
image.png

2) Shorebird を初期化

$ shorebird init

ルートに shorebird.yamlが生成されます。

$ shorebird init
✓ Fetching organizations (0.5s)
✓ Initializing gradlew (0.5s)
✓ No product flavors detected. (0.7s)
? How should we refer to this app? (shorebird_demo) shorebird_demo

🐦 Shorebird initialized successfully!

✅ A shorebird app has been created.
✅ A "shorebird.yaml" has been created.
✅ The "pubspec.yaml" has been updated to include "shorebird.yaml" as an asset.

Reference the following commands to get started:

📦 To create a new release use: "shorebird release".
🚀 To push an update use: "shorebird patch".
👀 To preview a release use: "shorebird preview".

For more information about Shorebird, visit https://shorebird.dev
✓ Shorebird is up-to-date (1.4s)
✓ AndroidManifest.xml files contain INTERNET permission (1 fix applied) (29ms)
✓ macOS app has correct entitlements (2 fixes applied) (4ms)
✓ shorebird.yaml found in pubspec.yaml assets (1ms)
✓ Lock files are tracked in source control (8ms)

3) 最初のリリースを作って端末に入れる

Shorebirdのパッチは、shorebird release で作ったバイナリにしか適用されません。
まず最初のリリース=「土台」を端末に入れます。

リリース作成

 $ shorebird release android --flutter-version=3.32.2

最初のリリースが作られました。

 $ shorebird release android --flutter-version=3.32.2
 
✓ Fetching apps (0.3s)
Building Android app bundle with Flutter 3.32.2 (8783bbe5d8)

...

Running Gradle task 'bundleRelease'...                             23.2s
✓ Built build/app/outputs/bundle/release/app-release.aab (50.5MB)
✓ Release version: 1.0.0+1 (1.3s)
✓ Fetching releases (0.3s)

🚀 Ready to create a new release!

📱 App: shorebird_demo (xxxx-xxxx-xxxx-xxxx)
📦 Release Version: 1.0.0+1
🕹️  Platform: android
🐦 Flutter Version: 3.32.2 (8783bbe5d8)

Would you like to continue? (y/N) Yes
✓ Fetching releases (0.3s)
✓ Creating release (1.3s)
✓ Updating release status (0.2s)
✓ Uploading artifacts (7.6s)
✓ Updating release status (0.3s)

✅ Published Release 1.0.0+1!

To create a patch for this release, run shorebird patch --platforms=android --release-version=1.0.0+1

Shorebird側にもreleaseが作成されています。
image.png

previewで今リリースしたアプリを起動します。

$ shorebird preview
$ shorebird preview
✓ Fetching releases (0.3s)
✓ Fetching releases (0.3s)
Which release would you like to preview? 1.0.0+1
✓ Fetching aab artifact (0.3s)
✓ Using stable track (0.4s)
✓ Downloading aot-tools.dill... (0.3s)
✓ Extracting aot-tools.dill... (0.8s)
✓ Extracting metadata (1.7s)
✓ Built apks: /.shorebird/bin/cache/previews/8a6c6332-6792-4f77-9772-3c919e4c6fd1/android_1.0.0+1_1343000.apks (2.2s)
✓ Installing apks (2.4s)
✓ Starting app (0.3s)
--------- beginning of main

4) 変更(タイトル & 背景色)

lib/main.dart を編集して、タイトル/テーマ/背景色を変更します。

  • タイトル
    • Flutter Demo Home Page → Flutter Demo Shorebird Patched
  • テーマ
    • Colors.deepPurple → Colors.red
void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo Shorebird Patched', // ⭐️Shorebird Patchedに変更
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.red), //⭐️redに変更
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Shorebird Patched'),
    );
  }
}

5) パッチを作って配信

$ shorebird patch android
$ shorebird patch android
✓ Fetching apps (0.3s)
✓ Fetching releases (0.3s)
Which release would you like to patch? 1.0.0+1
✓ Fetching aab artifact (0.3s)
✓ Downloading aab (100%) (2.6s)
Building patch with Flutter 3.32.2 (8783bbe5d8)

...

Running Gradle task 'bundleRelease'...                              4.6s
✓ Built build/app/outputs/bundle/release/app-release.aab (50.5MB)
✓ Verifying patch can be applied to release (16ms)
✓ Fetching release artifacts (0.8s)
✓ Downloading release artifact 1/3 (100%) (0.9s)
✓ Downloading release artifact 2/3 (100%) (1.2s)
✓ Downloading release artifact 3/3 (100%) (0.9s)
✓ Creating patch artifacts (1.8s)

🚀 Ready to publish a new patch!

📱 App: shorebird_demo (xxxx-xxxx-xxxx-xxxx)
📦 Release Version: 1.0.0+1
🕹️  Platform: Android [arm32 (35.19 KB), arm64 (54.37 KB), x86_64 (31.23 KB)]
🟢 Track: Stable

Would you like to continue? (y/N) Yes
✓ Creating patch (0.4s)
✓ Uploading artifacts (2.0s)
✓ Fetching channels (0.2s)
✓ Promoting patch to stable (0.3s)

✅ Published Patch 4!

補足:pubspec.yaml の version: x.y.z+build が 端末に入っているリリースと一致 している必要があります。latest 指定なら直近リリースに当たります。
shorebird patch android --release-version latest

Shorebird側にもPatchが確かに上がってます。(画像は4回Patchしてます。)
image.png

6) 端末で反映を確認

アプリを 一度起動 するとバックグラウンドでパッチをダウンロードします。

アプリを終了→再起動 すると、タイトルや背景色の変更が反映されます。

タイトルとテーマが、ビルド無しの再起動で変更されていることがわかります。(アップ可能な容量の関係で画質悪いです)
shorebird.gif

おわりに

Shorebirdを使って、軽微なUIテキストや色の修正を即座に配布でき、検証~反映のサイクルがかなり短縮されました。
参考になれば幸いです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?