Skip to content

Fix example app build on current Flutter - #13

Open
fa0311 wants to merge 1 commit into
salesforce-marketingcloud:mainfrom
fa0311:fix/example-app-modernization
Open

Fix example app build on current Flutter#13
fa0311 wants to merge 1 commit into
salesforce-marketingcloud:mainfrom
fa0311:fix/example-app-modernization

Conversation

@fa0311

@fa0311 fa0311 commented Jul 19, 2026

Copy link
Copy Markdown

Gets the example app (and the plugin's own gradle wrapper) working on current tooling:

  • io.flutter.app.FlutterApplication was removed in Flutter 3.29, so the example no longer compiles. MainApplication now extends android.app.Application; the snippet in Android.md is updated to match.
  • The MID placeholder in the example AppDelegate.m was missing its braces (MC_MID instead of {MC_MID}), so a brace-targeted find/replace leaves the literal string behind. Same fix in iOS_objc.md.
  • example/test/widget_test.dart was still the counter-app template and always failed under flutter test. Replaced with a smoke test that pumps the real app with the method channel mocked.
  • The plugin's own gradle wrapper was 8.0 while android/build.gradle declares AGP 8.6.1, which needs Gradle 8.7+. Bumped to 8.9 to match the example.

- Replace io.flutter.app.FlutterApplication with android.app.Application
  in the example's MainApplication.kt. The v1 Android embedding class was
  removed in Flutter 3.29 (stable), so the example app no longer compiled
  on any currently supported Flutter SDK. The SFMC initialization in
  onCreate() is unchanged. The same snippet in the Android.md integration
  guide is updated to match.

- Add missing braces to the MID placeholder in the example iOS
  AppDelegate.m ({MC_MID} instead of MC_MID) so it matches the other
  brace-delimited placeholders ({MC_APP_ID}, {MC_ACCESS_TOKEN},
  {MC_APP_SERVER_URL}). Previously a brace-targeted find/replace silently
  left the literal string "MC_MID" as the business unit MID. The same
  snippet in iOS_objc.md is updated to match.

- Replace the stale plugin-template widget test in example/test with a
  smoke test that pumps the real example app with the 'sfmc' method
  channel mocked and verifies the demo UI renders without exceptions.
  The old test asserted a 'Running on:' Text that does not exist in the
  app and always failed under 'flutter test'.

- Bump the plugin's own Gradle wrapper from 8.0 to 8.9. The plugin's
  android/build.gradle declares AGP 8.6.1, which requires Gradle 8.7+,
  so running ./gradlew in android/ failed with 'Minimum supported Gradle
  version is 8.7'. Gradle 8.9 matches the example app's wrapper.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants