MOEN-45889: Major version update - Dart/Flutter SDK, Melos, AGP 9.1.1, Kotlin 2.3.20, native Android SDK bump - #229
Conversation
|
🚪 Hodor is reviewing this PR... 👀 |
… SDK (#234) * MOEN-45889: Upgrade AGP to 9.1.1 and Kotlin to 2.3.20 to match native SDK Bump the Android Gradle Plugin and Kotlin Gradle plugin versions across the example app and all Flutter package Android modules (moengage_flutter/cards/inbox/geofence/personalize) to match the versions used by the native Android SDK. Also bump each module's Gradle wrapper to 9.3.1, the minimum Gradle version AGP 9.1.1 requires, and drop gradle.properties flags AGP 9 removed (android.defaults.buildfeatures.buildconfig, android.enableJetifier). AGP 9 bundles Kotlin support directly, so the separate `kotlin-android`/`org.jetbrains.kotlin.android` plugin application was removed from the example app; the plugin library modules still apply it via the third-party hybrid-module-config plugin and may need follow-up. KNOWN ISSUE: `flutter build apk` currently fails on every stable Flutter release (verified on 3.27.0 and 3.35.5) with a NullPointerException in FlutterPluginUtils.getAndroidExtension, because AGP 9 removed the legacy `BaseExtension` class Flutter's stable Gradle plugin still looks up. Confirmed via Flutter's `master` branch that this was only fixed there (refactored to ApplicationExtension/AgpCommonExtensionWrapper) and has not shipped in any stable release yet. This PR ships the version bump as requested; the local Android build cannot be verified until Flutter ships a stable release with AGP 9 support. * MOEN-45889: Update changelogs for AGP 9.1.1 / Kotlin 2.3.20 upgrade Add changelog entries across all Android package and public packages (moengage_flutter, moengage_cards, moengage_inbox, moengage_geofence, moengage_personalize) noting the Android Gradle Plugin and Kotlin version bump to match the native SDK's build tooling.
* MOEN-45889: Fix update-dependency workflow to derive changelog release type from version diff update-bom.main.kts and update-ios-deps.main.kts always tagged changelog entries as [minor], even for patch or major bumps. Both now compare the old and new version numbers to pick the correct [major]/[minor]/[patch] tag consumed by the pre-release script. * MOEN-45889: Android Dependency Update
arshiya-moengage
left a comment
There was a problem hiding this comment.
Automated review — inline comments below. Two release blockers (SNAPSHOT dependency, Flutter floor) plus a few clarity/test items. Overall the migration is clean and consistent.
| flutter: ">=3.0.0" | ||
| sdk: ">=3.6.0 <4.0.0" | ||
| flutter: ">=3.44.0" | ||
|
|
There was a problem hiding this comment.
The PR description says the BaseExtension NPE fix "first shipped in stable release 3.44.5", but the floor here is >=3.44.0. If Flutter 3.44.0–3.44.4 exist publicly, users on those versions still hit the exact NullPointerException this PR is meant to prevent. Unless 3.44.5 is the first release of that line, this should be >=3.44.5 (in every pubspec where it appears).
There was a problem hiding this comment.
Its a miss in PR description. Fix was in 3.44.0. No changes required. Updated the description.
| flutter_test: | ||
| sdk: flutter | ||
| mocktail: ^0.3.0 | ||
| mocktail: ^1.0.0 |
There was a problem hiding this comment.
mocktail 0.3.0 → 1.0.0 is a large major jump with API/null-safety changes, and no test files are touched in this PR. Please confirm melos run unittest compiles and passes against mocktail 1.x — this is the most likely place for a silent break.
There was a problem hiding this comment.
Is succeeding
| project(":$name").projectDir = pluginDirectory | ||
| plugins { | ||
| id "dev.flutter.flutter-plugin-loader" version "1.0.0" | ||
| // Kotlin support is built into AGP as of 9.0, so org.jetbrains.kotlin.android |
There was a problem hiding this comment.
This comment says Kotlin is built into AGP 9 so the Kotlin plugin is no longer applied — but gradle.properties sets android.builtInKotlin=false, which disables AGP's built-in Kotlin. These read as contradictory. If the intent is that the Flutter Gradle plugin applies external Kotlin (and built-in is disabled to avoid a conflict), please say that here — as written, a future maintainer could "fix" one side and break the build.
There was a problem hiding this comment.
Build will fail cause of other dependencies if we make builtInKotlin=true. Earlier hybrid config plugin was not updated which internally has built in kotlin. Now updated the version and added check to add kotlin android pluign if flag is enabled or less than AGP 9 for backward compatibility. Build working fine in both cases.
|
|
||
| // ── Semver Diff ────────────────────────────────────────────────────────────── | ||
|
|
||
| fun determineReleaseType(oldVersion: String, newVersion: String): String { |
There was a problem hiding this comment.
This determineReleaseType is duplicated verbatim in update-ios-deps.main.kts. Acceptable for standalone .kts scripts, but a // keep in sync with update-ios-deps.main.kts note would help. Two things worth a unit/table test since this now drives release-type classification: (1) suffix handling — "4.0.0-SNAPSHOT".split(".") → "0-SNAPSHOT".toIntOrNull() coerces to 0, so a patch-only change carrying a suffix won't be detected as patch; (2) the basic major/minor/patch cases.
There was a problem hiding this comment.
Updated to common utils script as for SNAPSHOT we are not supporting version update.
Jira Ticket
https://moengagetrial.atlassian.net/browse/MOEN-45889
Description
Major version/tooling update across the Flutter SDK workspace:
3.6.0and minimum Flutter SDK to3.44.0.8.1.0.plugins {}block /dev.flutter.flutter-plugin-loader), replacing the old imperativeapplystyle.9.1.1and Kotlin to2.3.20across the example app and all Flutter package Android modules (moengage_flutter,moengage_cards,moengage_inbox,moengage_geofence,moengage_personalize), matching the native Android SDK's build tooling. Also bumped each module's Gradle wrapper to9.3.1(the minimum AGP 9.1.1 requires), addedcompileSdk 36to every package module (required by the native SDK bump below), and droppedgradle.propertiesflags AGP 9 removed (android.defaults.buildfeatures.buildconfig,android.enableJetifier).android-bomto4.0.0andplugin-base-bomto4.0.0-SNAPSHOT.GlobalResources/Loggerusages across all Android bridge modules to the native SDK's newPlatformResources/platform.internal.logger.LoggerAPIsWhy the Flutter minimum moved to 3.44.0
AGP 9 removed the legacy
com.android.build.gradle.BaseExtensionclass that Flutter's Gradle plugin used to look up the Android extension (FlutterPluginUtils.getAndroidExtension). Every Flutter stable release through3.35.5still callsproject.extensions.findByType(BaseExtension::class.java)!!, which now returnsnulland crashes with aNullPointerExceptionas soon asdev.flutter.flutter-gradle-pluginis applied — this reproduced identically on3.27.0and3.35.5during verification. Flutter fixed this by refactoring toApplicationExtension/AgpCommonExtensionWrapper, which first shipped in stable release3.44.0. Since AGP9.1.1is a hard requirement for this PR (matching the native Android SDK), any Flutter version below the one carrying that fix cannot build this workspace's Android target at all — hence the minimum is raised to3.44.0, the stable line carrying the fix.