Skip to content

MOEN-45889: Major version update - Dart/Flutter SDK, Melos, AGP 9.1.1, Kotlin 2.3.20, native Android SDK bump - #229

Open
kkgowtham-engg-sdk wants to merge 7 commits into
developmentfrom
feature/MOEN-45889_major_version_update
Open

MOEN-45889: Major version update - Dart/Flutter SDK, Melos, AGP 9.1.1, Kotlin 2.3.20, native Android SDK bump#229
kkgowtham-engg-sdk wants to merge 7 commits into
developmentfrom
feature/MOEN-45889_major_version_update

Conversation

@kkgowtham-engg-sdk

@kkgowtham-engg-sdk kkgowtham-engg-sdk commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Jira Ticket

https://moengagetrial.atlassian.net/browse/MOEN-45889

Description

Major version/tooling update across the Flutter SDK workspace:

  • Bumped minimum supported Dart SDK to 3.6.0 and minimum Flutter SDK to 3.44.0.
  • Migrated the workspace to Melos 8.1.0.
  • Migrated the example app to the declarative Flutter Gradle plugin (plugins {} block / dev.flutter.flutter-plugin-loader), replacing the old imperative apply style.
  • Upgraded the Android Gradle Plugin (AGP) to 9.1.1 and Kotlin to 2.3.20 across 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 to 9.3.1 (the minimum AGP 9.1.1 requires), added compileSdk 36 to every package module (required by the native SDK bump below), and dropped gradle.properties flags AGP 9 removed (android.defaults.buildfeatures.buildconfig, android.enableJetifier).
  • Bumped native Android SDK dependencies: android-bom to 4.0.0 and plugin-base-bom to 4.0.0-SNAPSHOT.
  • Migrated GlobalResources/Logger usages across all Android bridge modules to the native SDK's new PlatformResources/platform.internal.logger.Logger APIs

Why the Flutter minimum moved to 3.44.0

AGP 9 removed the legacy com.android.build.gradle.BaseExtension class that Flutter's Gradle plugin used to look up the Android extension (FlutterPluginUtils.getAndroidExtension). Every Flutter stable release through 3.35.5 still calls project.extensions.findByType(BaseExtension::class.java)!!, which now returns null and crashes with a NullPointerException as soon as dev.flutter.flutter-gradle-plugin is applied — this reproduced identically on 3.27.0 and 3.35.5 during verification. Flutter fixed this by refactoring to ApplicationExtension/AgpCommonExtensionWrapper, which first shipped in stable release 3.44.0. Since AGP 9.1.1 is 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 to 3.44.0, the stable line carrying the fix.

@moe-hodor

moe-hodor Bot commented Jul 7, 2026

Copy link
Copy Markdown

🚪 Hodor is reviewing this PR... 👀

@moe-hodor moe-hodor Bot added cfr:neutral Change Failure Rate: neutral impact branch:feature Planned work — new functionality or enhancement (neutral CFR) labels Jul 7, 2026
Comment thread example/android/app/build.gradle
Comment thread example/android/app/build.gradle
Comment thread example/android/app/build.gradle
Comment thread example/android/build.gradle
Comment thread example/pubspec.yaml
Comment thread example/pubspec.yaml

@moe-hodor moe-hodor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Branching & CFR: feature/MOEN-45889_major_version_update — category: feature, impact: Neutral CFR

Issues (7 after filtering):
🔴 Critical: 1
⚠️ Warning: 4
💡 Suggestion: 2

Hodor filtered 2 low-signal comment(s) to reduce noise.
Verdict: COMMENT

kkgowtham-engg-sdk and others added 3 commits July 7, 2026 18:32
… 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
@kkgowtham-engg-sdk kkgowtham-engg-sdk changed the title MOEN-45889: Bump minimum Dart SDK to 3.6.0 and Flutter SDK to 3.27.0 and Melos 8.x migration MOEN-45889: Major version update - Dart/Flutter SDK, Melos, AGP 9.1.1, Kotlin 2.3.20, native Android SDK bump Jul 9, 2026

@arshiya-moengage arshiya-moengage left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.03.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).

@kkgowtham-engg-sdk kkgowtham-engg-sdk Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread .github/scripts/update-bom.main.kts Outdated

// ── Semver Diff ──────────────────────────────────────────────────────────────

fun determineReleaseType(oldVersion: String, newVersion: String): String {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to common utils script as for SNAPSHOT we are not supporting version update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

branch:feature Planned work — new functionality or enhancement (neutral CFR) cfr:neutral Change Failure Rate: neutral impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants