Skip to content

Troubleshooting

Platform note

All iOS-related sections below (Swift Package Manager, Xcode, deployment target, HealthKit) apply to macOS only — building and running the iOS app requires a Mac with Xcode. The Android and Dart sections apply to macOS, Linux, and Windows alike.

MissingPluginException / method channel not available

Error:

MissingPluginException(No implementation found for method deviceIdentifier on channel trainingkit_flutter)

The native plugin was not registered. A hot reload is not sufficient after adding a native package — do a full rebuild:

sh
flutter clean
flutter pub get
flutter run

iOS: plugin or TrainingKit not found

If the iOS build cannot find the plugin or the TrainingKit module, make sure Flutter's Swift Package Manager is enabled (this plugin is distributed as a Swift Package):

sh
flutter config --enable-swift-package-manager
flutter clean
flutter run

iOS: TrainingKit package fails to resolve

Error:

Failed to resolve dependencies: ... trainingkit-ios-sdk

The first iOS build resolves the TrainingKit Swift package from GitHub, so it needs network access. Check connectivity and that https://github.com/getfizzup/trainingkit-ios-sdk is reachable, then rebuild. To force a fresh resolution, delete the resolved state and rebuild:

sh
rm -rf ios/Runner.xcworkspace/xcshareddata/swiftpm
flutter clean
flutter run

iOS: deployment target

The plugin's Swift package requires an iOS deployment target of 15.1 or higher. If the build complains the deployment target is too low, raise it on the Xcode Runner target (iOS Deployment Target, or IPHONEOS_DEPLOYMENT_TARGET in project.pbxproj).

iOS: crash when launching a classic workout

The classic workout flow requests HealthKit authorization. iOS terminates the app if the usage description strings are missing. Add them to ios/Runner/Info.plist:

xml
<key>NSHealthShareUsageDescription</key>
<string>Read workout and energy data to track your sessions.</string>
<key>NSHealthUpdateUsageDescription</key>
<string>Save completed workouts to Apple Health.</string>

Android: cannot resolve com.fizzup:trainingkit

Error:

Could not resolve com.fizzup:trainingkit:vX

The GitHub Packages Maven repository requires credentials.

  1. Check that GithubUser / GithubToken are present in your app's android/local.properties, or that GITHUB_USERNAME / GITHUB_TOKEN are exported in the environment.
  2. The FizzUp Maven repository itself is declared by the package; you do not need to add it to your app.

See Installation – Android setup for the full configuration.

Android: minSdk too low

Error:

uses-sdk:minSdkVersion 21 cannot be smaller than version 24 declared in library [:trainingkit_flutter]

TrainingKit requires Android API level 24 or higher. Set minSdk = 24 in your app's android/app/build.gradle.kts.

Dependency changes do not update

Git dependency pinned to a branch

flutter pub get records the resolved commit in pubspec.lock, so pointing at a branch (e.g. ref: main) will not pick up newer commits automatically. To pull the latest commit on the same ref:

sh
flutter pub upgrade trainingkit_flutter

For reproducible builds, pin a release tag (ref: v0.1.0) and bump it deliberately.

Local path dependency

When using a local path dependency:

yaml
dependencies:
  trainingkit_flutter:
    path: ../relative/path/to/trainingkit-flutter

Changes to the package's native code are not reflected until you rebuild the native app:

sh
flutter clean
flutter pub get
flutter run