プラットフォーム設定
iOS
iOSをターゲットにする場合、Amplifyには最小デプロイメントターゲット13.0以上およびXcode 15.0以上が必要です。以下の手順に従って、最小デプロイメントターゲットを更新してください。
ios/Podfileを開き、ターゲットiOSプラットフォームを13.0以上に更新します。
- # Uncomment this line to define a global platform for your project- # platform :ios, '12.0'+ platform :ios, '13.0'Xcodeでプロジェクトを開き、Runner、Targets -> Runnerの順に選択し、「General」タブをクリックします。「Minimum Deployments」セクションで、iOSバージョンを13.0以上に更新します。
Runner、Project -> Runnerの順に選択し、「Build Settings」タブをクリックします。「iOS Deployment Target」を13.0以上に更新します。
Android
Amplify FlutterはAPIレベル24以上(Android 7.0以上)をサポートしており、Androidをターゲットにする場合、Gradle 8以上、Kotlin 1.9以上、Java 17以上が必要です。以下の手順に従って、アプリケーションでこれらの変更を適用してください。
android/settings.gradle.ktsを開き、Android GradleプラグインとKotlinのバージョンを更新します:
plugins { id("dev.flutter.flutter-plugin-loader") version "1.0.0"- id("com.android.application") version "8.7.0" apply false- id("org.jetbrains.kotlin.android") version "1.8.22" apply false+ id("com.android.application") version "8.12.1" apply false+ id("org.jetbrains.kotlin.android") version "2.2.0" apply false}android/gradle/wrapper/gradle-wrapper.propertiesを開き、GradledistributionUrlを更新します。
distributionBase=GRADLE_USER_HOMEdistributionPath=wrapper/distszipStoreBase=GRADLE_USER_HOMEzipStorePath=wrapper/dists-distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip+distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-all.zipandroid/app/build.gradle.ktsを開き、Javaバージョンと最小AndroidSDKバージョンを更新します。
android { namespace = "com.example.myapp" compileSdk = flutter.compileSdkVersion ndkVersion = flutter.ndkVersion compileOptions {- sourceCompatibility = JavaVersion.VERSION_1_8- targetCompatibility = JavaVersion.VERSION_1_8+ sourceCompatibility = JavaVersion.VERSION_17+ targetCompatibility = JavaVersion.VERSION_17 } kotlinOptions {- jvmTarget = JavaVersion.VERSION_11.toString()+ jvmTarget = JavaVersion.VERSION_17.toString() } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId = "com.example.myapp" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.- minSdk = flutter.minSdkVersion+ minSdk = 24 targetSdk = flutter.targetSdkVersion versionCode = flutterVersionCode.toInteger() versionName = flutterVersionName } buildTypes { release { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. signingConfig = signingConfigs.debug } }}android/settings.gradleを開き、Android GradleプラグインとKotlinのバージョンを更新します:
plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0"- id "com.android.application" version "7.3.0" apply false- id "org.jetbrains.kotlin.android" version "1.7.10" apply false+ id "com.android.application" version "8.12.1" apply false+ id "org.jetbrains.kotlin.android" version "2.2.0" apply false}android/gradle/wrapper/gradle-wrapper.propertiesを開き、GradledistributionUrlを更新します。
distributionBase=GRADLE_USER_HOMEdistributionPath=wrapper/distszipStoreBase=GRADLE_USER_HOMEzipStorePath=wrapper/dists-distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-all.zip+distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-all.zipandroid/app/build.gradleを開き、Javaバージョンと最小AndroidSDKバージョンを更新します。
android { namespace = "com.example.myapp" compileSdk = flutter.compileSdkVersion ndkVersion = flutter.ndkVersion compileOptions {- sourceCompatibility = JavaVersion.VERSION_11- targetCompatibility = JavaVersion.VERSION_11+ sourceCompatibility = JavaVersion.VERSION_17+ targetCompatibility = JavaVersion.VERSION_17 } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId = "com.example.myapp" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.- minSdk = flutter.minSdkVersion+ minSdk = 24 targetSdk = flutter.targetSdkVersion versionCode = flutterVersionCode.toInteger() versionName = flutterVersionName } buildTypes { release { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. signingConfig = signingConfigs.debug } }}リリースビルドのネットワークパーミッション
Flutterアプリはデバッグモードではデフォルトでネットワークリクエストを作成するアクセス権を持っています。このパーミッションはリリースモードでビルドする場合に追加する必要があります。これを行うには、android/app/src/main/AndroidManifest.xmlを開き、以下の追加を行います。
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <uses-permission android:name="android.permission.INTERNET"/>...</manifest>Web
Webをターゲットにする場合、Amplify固有の要件やセットアップ手順はありません。Flutterがサポートするブラウザを使用する必要があります。詳細は以下のFlutterドキュメントを参照してください:
macOS
macOSをターゲットにする場合、Amplifyには最小デプロイメントターゲット10.15以上およびXcode 15.0以上が必要です。さらに、ネットワーク、キーチェーンのエンタイトルメント、およびコード署名を有効にする必要があります。
最小バージョンの更新
macos/Podfileを開き、ターゲットmacOSプラットフォームを10.15以上に更新します。
- platform :osx, '10.14'+ platform :osx, '10.15'Xcodeでプロジェクトを開き、Runner、Targets -> Runnerの順に選択し、「General」タブをクリックします。「Minimum Deployments」セクションで、macOSバージョンを10.15以上に更新します。
Runner、Project -> Runnerの順に選択し、「Info」タブをクリックします。「macOS Deployment Target」を10.15以上に更新します。
ネットワーク呼び出しを有効にする
Xcodeでプロジェクトを開き、Runner、Targets -> Runnerの順に選択し、「Signing and Capabilities」タブをクリックします。「App Sandbox」の下で「Outgoing Connections (Client)」を選択します。
ネットワークエンタイトルメントの詳細については、Appleのドキュメントcom.apple.security.network.clientを参照してください。
キーチェーン共有を有効にする
Xcodeでプロジェクトを開き、Runner、Targets -> Runnerの順に選択し、「Signing and Capabilities」タブをクリックします。
- 「+アイコン」をクリックします。
- 後続のモーダルで「Keychain Sharing」を検索し、追加します。
- 「Signing and Capabilities」の「Keychain Sharing」までスクロールダウンし、「+」アイコンをクリックします。デフォルトではバンドルIDが使用されます。
- 最後に、開発チームを追加して署名を有効にします。
Windows
Windowsをターゲットにする場合、Amplify固有の要件やセットアップ手順はありません。FlutterがサポートするWindowsバージョンを使用する必要があります。詳細は以下のFlutterドキュメントを参照してください:
Linux
Amplify FlutterはLinuxをターゲットにする場合、libsecretライブラリに依存しています。
ローカル開発
Amplify Flutterに依存するアプリを実行およびデバッグするには、libsecret-1-devをインストールする必要があります。以下のコマンドを実行してlibsecret-1-devをインストールしてください。これによりlibglib2.0-devなどのlibsecret-1-devの依存関係もインストールされます。
sudo apt-get updatesudo apt-get install -y libsecret-1-devアプリをパッケージ化する
Snapcraftを使用してアプリをパッケージ化する場合、必要な依存関係をsnapcraft.yamlファイルに含めます。詳細については、Flutterのスナップストアへのリリースに関するドキュメントを参照してください。
parts: my-app: plugin: flutter source: . flutter-target: lib/main.dart build-packages: - libsecret-1-dev stage-packages: - libsecret-1-0