diff --git a/public/images/project-setup/flutter/ios/project-min-deployment-version.png b/public/images/project-setup/flutter/ios/project-min-deployment-version.png index 7785ca6f540..a0a04a15180 100644 Binary files a/public/images/project-setup/flutter/ios/project-min-deployment-version.png and b/public/images/project-setup/flutter/ios/project-min-deployment-version.png differ diff --git a/src/fragments/lib-v1/datastore/flutter/getting-started/20_installLib.mdx b/src/fragments/lib-v1/datastore/flutter/getting-started/20_installLib.mdx index f037d40c76f..158a42ee180 100644 --- a/src/fragments/lib-v1/datastore/flutter/getting-started/20_installLib.mdx +++ b/src/fragments/lib-v1/datastore/flutter/getting-started/20_installLib.mdx @@ -13,6 +13,29 @@ dependencies: ### Update The Android Project + + +1. Open `android/app/build.gradle.kts` and enable `isCoreLibraryDesugaringEnabled` in `compileOptions` to support the Java8 feature used in the DataStore plugin. + +```diff title="android/app/build.gradle.kts" +compileOptions { ++ isCoreLibraryDesugaringEnabled = true + + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} +``` + +2. Add the following dependency in `dependencies`. + +```diff title="android/app/build.gradle.kts" +dependencies { ++ coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:1.1.5") ++ implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.10") +} +``` + + Open `build.gradle` located under `android/app`, and enable `coreLibraryDesugaringEnabled` in `compileOptions` to support the Java8 feature used in the DataStore plugin. ```groovy @@ -35,3 +58,5 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } ``` + + diff --git a/src/fragments/lib-v1/push-notifications/common/getting_started/cross-platform-prereq.mdx b/src/fragments/lib-v1/push-notifications/common/getting_started/cross-platform-prereq.mdx index 0839ad3bae0..ae45966571c 100644 --- a/src/fragments/lib-v1/push-notifications/common/getting_started/cross-platform-prereq.mdx +++ b/src/fragments/lib-v1/push-notifications/common/getting_started/cross-platform-prereq.mdx @@ -33,11 +33,36 @@ import fcmPreReq from '/src/fragments/lib-v1/push-notifications/android/getting_ ### Applying the Google services plugin + + +1. Open `android/settings.gradle.kts` and add the Google Services plugin: +```diff title="android/settings.gradle.kts" +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.1.0" apply false + id("org.jetbrains.kotlin.android") version "1.9.10" apply false ++ id("com.google.gms.google-services") version "4.3.14" apply false +} +``` +2. Open `android/app/build.gradle.kts` and add the Google Services plugin: +```diff title="android/app/build.gradle.kts" +plugins { + id("com.android.application") + id("kotlin-android") + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id("dev.flutter.flutter-gradle-plugin") ++ id("com.google.gms.google-services") +} +``` + + The Firebase documentation directs you to add the Google services plugin to your app `build.gradle` using the [Gradle plugins DSL](https://docs.gradle.org/current/userguide/plugins.html#sec:plugins_block). However, we recommend you continue to use the [Legacy Plugin Application](https://docs.gradle.org/current/userguide/plugins.html#sec:old_plugin_application) instead: ```groovy apply plugin: 'com.google.gms.google-services' ``` + + If you prefer using the plugins DSL, you should add the `plugins` block to the very top of the file or you may experience issues when building your app for Android. diff --git a/src/fragments/lib/datastore/flutter/getting-started/20_installLib.mdx b/src/fragments/lib/datastore/flutter/getting-started/20_installLib.mdx index c9767d981dd..b53f79c052d 100644 --- a/src/fragments/lib/datastore/flutter/getting-started/20_installLib.mdx +++ b/src/fragments/lib/datastore/flutter/getting-started/20_installLib.mdx @@ -13,6 +13,29 @@ dependencies: ### Update The Android Project + + +1. Open `android/app/build.gradle.kts` and enable `isCoreLibraryDesugaringEnabled` in `compileOptions` to support the Java8 feature used in the DataStore plugin. + +```diff title="android/app/build.gradle.kts" +compileOptions { ++ isCoreLibraryDesugaringEnabled = true + + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} +``` + +2. Add the following dependency in `dependencies`. + +```diff title="android/app/build.gradle.kts" +dependencies { ++ coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:1.1.5") ++ implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.10") +} +``` + + Open `build.gradle` located under `android/app`, and enable `coreLibraryDesugaringEnabled` in `compileOptions` to support the Java8 feature used in the DataStore plugin. ```groovy @@ -35,3 +58,5 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } ``` + + diff --git a/src/fragments/lib/project-setup/flutter/platform-setup/android.mdx b/src/fragments/lib/project-setup/flutter/platform-setup/android.mdx index 6bf26008f56..88f13aa72f8 100644 --- a/src/fragments/lib/project-setup/flutter/platform-setup/android.mdx +++ b/src/fragments/lib/project-setup/flutter/platform-setup/android.mdx @@ -4,6 +4,73 @@ Amplify Flutter supports API level 24+ (Android 7.0+), and requires Gradle 8+, K The steps below are intended for Flutter apps created with Flutter version 3.16+. If your app was created prior to version 3.16, please follow the guide [here](https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply) to migrate to Gradle's declarative plugins block before following the steps below. + + +1. Open `android/settings.gradle.kts` and update the Android Gradle plugin and kotlin versions: + +```diff title="android/settings.gradle.kts" +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.1.0" apply false ++ id("org.jetbrains.kotlin.android") version "1.9.10" apply false +} +``` + +2. Open `android/gradle/wrapper/gradle-wrapper.properties` and update the Gradle `distributionUrl`. + +```diff title="android/gradle/wrapper/gradle-wrapper.properties" +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +-distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip ++distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip +``` + +3. Open `android/app/build.gradle.kts` and update the Java version and minimum Android SDK version. + +```diff title="android/app/build.gradle.kts" +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 + } + + 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 + } + } +} +``` + + 1. Open `android/settings.gradle` and update the Android Gradle plugin and kotlin versions: ```diff title="android/settings.gradle" @@ -62,6 +129,8 @@ android { } } ``` + + If you would like to use a higher version of Gradle or Android Gradle plugin see the compatibility matrix [here](https://developer.android.com/build/releases/gradle-plugin#updating-gradle). diff --git a/src/fragments/lib/project-setup/flutter/platform-setup/ios.mdx b/src/fragments/lib/project-setup/flutter/platform-setup/ios.mdx index 4a05745764c..e4935d3cfd9 100644 --- a/src/fragments/lib/project-setup/flutter/platform-setup/ios.mdx +++ b/src/fragments/lib/project-setup/flutter/platform-setup/ios.mdx @@ -10,6 +10,6 @@ Open your project in Xcode and select Runner, Targets -> Runner and then the "Ge ![Setting the iOS version to 13.0 or higher in the minimum deployments section of the Runner general window.](/images/project-setup/flutter/ios/target-min-deployment-version.png) -Select Runner, Project -> Runner and then the "Info" tab. Update "iOS Deployment Target" to 13.0 or higher. +Select Runner, Project -> Runner and then the "Build Settings" tab. Update "iOS Deployment Target" to 13.0 or higher. ![Setting the iOS version to 13.0 or higher in the deployment targets section of the Runner info window.](/images/project-setup/flutter/ios/project-min-deployment-version.png) diff --git a/src/fragments/lib/push-notifications/common/getting_started/cross-platform-prereq.mdx b/src/fragments/lib/push-notifications/common/getting_started/cross-platform-prereq.mdx index 3fdb66aed6e..7d0d4969319 100644 --- a/src/fragments/lib/push-notifications/common/getting_started/cross-platform-prereq.mdx +++ b/src/fragments/lib/push-notifications/common/getting_started/cross-platform-prereq.mdx @@ -45,12 +45,36 @@ If you prefer using the plugins DSL, you should add the `plugins` block to the v - + + +1. Open `android/settings.gradle.kts` and add the Google Services plugin: +```diff title="android/settings.gradle.kts" +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.1.0" apply false + id("org.jetbrains.kotlin.android") version "1.9.10" apply false ++ id("com.google.gms.google-services") version "4.3.14" apply false +} +``` +2. Open `android/app/build.gradle.kts` and add the Google Services plugin: +```diff title="android/app/build.gradle.kts" +plugins { + id("com.android.application") + id("kotlin-android") + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id("dev.flutter.flutter-gradle-plugin") ++ id("com.google.gms.google-services") +} +``` + + The Firebase documentation directs you to add the Google services plugin to your app `settings.gradle` using the [Gradle plugins DSL](https://docs.gradle.org/current/userguide/plugins.html#sec:plugins_block). However, we recommend you continue to use the [Legacy Plugin Application](https://docs.gradle.org/current/userguide/plugins.html#sec:old_plugin_application) instead: -```groovy +```groovy title="android/settings.gradle" id "com.google.gms:google-services" version "4.3.14" apply false ``` + + diff --git a/src/pages/[platform]/start/platform-setup/index.mdx b/src/pages/[platform]/start/platform-setup/index.mdx index 02be15665bf..208e0f9410a 100644 --- a/src/pages/[platform]/start/platform-setup/index.mdx +++ b/src/pages/[platform]/start/platform-setup/index.mdx @@ -42,7 +42,7 @@ Open your project in Xcode and select Runner, Targets -> Runner and then the "Ge ![Setting the iOS version to 13.0 or higher in the minimum deployments section of the Runner general window.](/images/project-setup/flutter/ios/target-min-deployment-version.png) -Select Runner, Project -> Runner and then the "Info" tab. Update "iOS Deployment Target" to 13.0 or higher. +Select Runner, Project -> Runner and then the "Build Settings" tab. Update "iOS Deployment Target" to 13.0 or higher. ![Setting the iOS version to 13.0 or higher in the deployment targets section of the Runner info window.](/images/project-setup/flutter/ios/project-min-deployment-version.png) @@ -54,6 +54,73 @@ Amplify Flutter supports API level 24+ (Android 7.0+), and requires Gradle 8+, K The steps below are intended for Flutter apps created with Flutter version 3.16+. If your app was created prior to version 3.16, please follow the guide [here](https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply) to migrate to Gradle's declarative plugins block before following the steps below. + + +1. Open `android/settings.gradle.kts` and update the Android Gradle plugin and kotlin versions: + +```diff title="android/settings.gradle.kts" +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.1.0" apply false ++ id("org.jetbrains.kotlin.android") version "1.9.10" apply false +} +``` + +2. Open `android/gradle/wrapper/gradle-wrapper.properties` and update the Gradle `distributionUrl`. + +```diff title="android/gradle/wrapper/gradle-wrapper.properties" +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +-distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip ++distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip +``` + +3. Open `android/app/build.gradle.kts` and update the Java version and minimum Android SDK version. + +```diff title="android/app/build.gradle.kts" +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 + } + + 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 + } + } +} +``` + + 1. Open `android/settings.gradle` and update the Android Gradle plugin and kotlin versions: ```diff title="android/settings.gradle" @@ -112,6 +179,8 @@ android { } } ``` + + If you would like to use a higher version of Gradle or Android Gradle plugin see the compatibility matrix [here](https://developer.android.com/build/releases/gradle-plugin#updating-gradle).