Upgrading
Moving a Flutter app to a new Sophonz Flutter SDK release — changing the git tag in every entry, updating pubspec.lock, and keeping the Android Gradle plugin and the iOS SophonzIO pod at the versions the release is built against.
Releases are git tags of sophonz-labs/sophonz-flutter-sdk named vX.Y.Z, each with a GitHub Release. All six packages share the version. An upgrade is a tag change in pubspec.yaml, plus the native SDK versions when the release notes say they moved.
Finding releases
- The GitHub Releases page lists every release. The notes name the Sophonz Android SDK and
SophonzIOversions the release is built against. - From a terminal:
git ls-remote --tags git@github.com:sophonz-labs/sophonz-flutter-sdk.git.
Each release's native versions are also in the repository at that tag:
| Native dependency | File at the tag |
|---|---|
| Android SDK and Gradle plugin | sophonz_android/android/gradle.properties (spz_android_sdk) |
SophonzIO for CocoaPods | sophonz_ios/ios/sophonz_ios.podspec |
sophonz-apple-sdk for Swift Package Manager | sophonz_ios/ios/sophonz_ios/Package.swift |
Steps
1. Change the tag everywhere
Every ref in pubspec.yaml has to name the same tag, under dependencies and dependency_overrides alike. Mixing tags either fails to resolve or, because overrides always win, silently combines packages from different releases.
dependencies:
sophonz:
git: {url: git@github.com:sophonz-labs/sophonz-flutter-sdk.git, path: sophonz, ref: v0.2.0}
sophonz_dio:
git: {url: git@github.com:sophonz-labs/sophonz-flutter-sdk.git, path: sophonz_dio, ref: v0.2.0}
dependency_overrides:
sophonz:
git: {url: git@github.com:sophonz-labs/sophonz-flutter-sdk.git, path: sophonz, ref: v0.2.0}v0.2.0 stands for the release you are moving to.
2. Update pubspec.lock
flutter pub upgrade sophonz sophonz_dio sophonz_go_routerName the Sophonz packages you use. pubspec.lock then records the new commit; commit it so CI and teammates build the same code.
3. Android: Gradle plugin version
If spz_android_sdk changed, set the Gradle plugin to the same version:
plugins {
id("io.sophonz.gradle") version "1.1.0" apply false
}1.1.0 stands for the value of spz_android_sdk. A plugin left behind installs an older SDK than the Flutter plugin was compiled against. In a debug run, the Dart side compares the Android SDK version with the release's minimum and prints WARNING: You are using Sophonz Android SDK … when it is lower.
Check android/app/src/main/sophonz-config.json against the Android configuration reference for the new SDK version. A key the new parser does not know fails the build.
4. iOS: SophonzIO version
With CocoaPods, change the tag in the Podfile to the SophonzIO version the podspec names, then update the pod:
pod 'SophonzIO', :git => 'https://github.com/sophonz-labs/sophonz-apple-sdk.git', :tag => 'v1.1.0'cd ios && pod update SophonzIOWith Swift Package Manager, sophonz_ios pins sophonz-apple-sdk to an exact version, so there is nothing to edit. If Xcode keeps building the old version, run flutter clean and build again.
Review AppDelegate.swift and Sophonz-Info.plist against the release notes. Start options can change between Apple SDK versions.
5. Rebuild and verify
flutter clean
flutter runIn the debug console, Sophonz Flutter SDK Version: shows the new version, followed by Sophonz Flutter SDK attached to host SDK successfully.. Then check that a session from each platform reaches Sophonz. On iOS, background the app first.
Pinning and rolling back
- To roll back, set every
refto the previous tag and run step 2 again, along with the native versions of that tag. refalso accepts a commit SHA. Use tags for anything you ship; a branch name moves under you andpubspec.lockis the only record of what you built.- Keep
pubspec.lockcommitted. Without it,flutter pub geton another machine resolves the tag again, which gives the same commit only as long as the tag is never moved.
Next
- Installation — the full setup these steps change
- Release builds — upload mappings and dSYMs for the new build