Skip to content

Flutter integration

appelium_feedback is the Appelium SDK for apps built with Flutter. It adds in-app bug reporting, crash and error reporting, network monitoring, session monitoring and performance traces to your iOS and Android app, and every feature stays off until you enable it. This guide shows how to add the package, start it from your main function and choose the features you need.

Is this the right SDK for your app?

Your app SDK
Built with Flutter, for iOS, Android or both This package, appelium_feedback
Native iOS app, with SwiftUI or UIKit AppeliumFeedback for iOS
Native Android app, with Views or Jetpack Compose AppeliumFeedback for Android
Native app that shows some Flutter screens (add-to-app) The native SDK of the app's platform

The package contains the native AppeliumFeedback SDKs for iOS and Android and starts them from Dart: bug reports use the native form of each platform, and crash reports come from the native crash reporters. Do not add or start the native SDKs yourself. Your Swift or Kotlin code can still call them once the SDK is started.

Requirements

  • Flutter 3.47 and Dart 3.13 or later.
  • iOS 16 or later, with Flutter's Swift Package Manager support, which is on by default. The package does not support CocoaPods; if you turned the support off, turn it on again with flutter config --enable-swift-package-manager. CocoaPods can keep serving your other plugins.
  • Android 9 (API 28) or later, which you set as your app's minSdk. The package uses your app's Android Gradle plugin and Kotlin versions.
  • Two API keys, one for the iOS and one for the Android application of your app. Create an application for each platform in the Dashboard and find its key in the application's settings. No account yet? Bug and crash reporting are part of the free plan.
  • No runtime permissions: the SDK never asks the user for one. See Permissions.

Web and desktop are not supported. See Limitations.

Install

Add the package to your app:

flutter pub add appelium_feedback

On Android, raise your app's minimum SDK to 28 in android/app/build.gradle.kts, because new Flutter projects use a lower one:

android {
    defaultConfig {
        minSdk = 28
    }
}

Start the SDK

Call AppeliumFeedback.start once, in main, before runApp. Pass the API keys of both applications; the SDK uses the key of the platform the app runs on:

import 'package:appelium_feedback/appelium_feedback.dart';
import 'package:flutter/material.dart';

void main() {
  AppeliumFeedback.start(
    apiKeys: const AppeliumApiKeys(
      ios: 'YOUR_IOS_API_KEY',
      android: 'YOUR_ANDROID_API_KEY',
    ),
    bugReporting: const BugReportingConfiguration.enabled(),
  );

  runApp(const MyApp());
}
  • start initializes the Flutter binding if none exists, as runApp does. If your app uses a custom binding, initialize it before start.
  • Call start from the main isolate. Calls from other isolates are ignored.
  • Crashes that happen before start are not reported, so do slow initialization work, such as opening a database, after it.
  • Calls to other SDK methods before start are ignored. In debug builds, most of them also fail an assertion, so that you notice.
  • A second call to start is ignored. The SDK starts once per app process and keeps its configuration across hot restarts, so stop the app and run it again after you change the parameters of start.

You can also start the SDK later, for example after the user's consent. The SDK then picks up the screen that is already shown.

Enable features

All features are off by default, so nothing is collected that you did not ask for. Calling start with only the API keys does nothing. Enable each feature you need with its parameter of start:

AppeliumFeedback.start(
  apiKeys: const AppeliumApiKeys(
    ios: 'YOUR_IOS_API_KEY',
    android: 'YOUR_ANDROID_API_KEY',
  ),
  bugReporting: const BugReportingConfiguration.enabled(),
  crashReporting: CrashReportingConfiguration.enabled,
  errorReporting: ErrorReportingConfiguration.enabled,
  networkMonitoring: NetworkMonitoringConfiguration.enabled,
  sessionMonitoring: SessionMonitoringConfiguration.enabled,
  performanceTraces: PerformanceTracesConfiguration.enabled,
);
Parameter What it enables Guide
bugReporting The in-app bug report form, opened by a shake or from code, and silent reports Bug reports
crashReporting Crash reports, uploaded on the next launch Crash reports
errorReporting Non-fatal error reports and automatic ANR detection Error reports
networkMonitoring Aggregated network performance metrics Network monitoring
sessionMonitoring Session duration and the sessions behind crash-free rates and release adoption Session monitoring
performanceTraces Custom traces and the automatic App Start trace Performance traces
proxy Routing the SDK's traffic through your own server Passthrough-Proxy
logsRetention How much log history accompanies each report Logs retention

Console logs and network logs are recorded whenever the SDK is started. They are uploaded only as part of a bug, crash or error report. See Console logs and Network logs.

Logs retention

Each report includes the activity log (console logs, network logs and app events) from the last 180 seconds before the report, with no limit on the number of entries. Change it with the logsRetention parameter:

AppeliumFeedback.start(
  apiKeys: apiKeys,
  crashReporting: CrashReportingConfiguration.enabled,
  logsRetention: const LogsRetentionConfiguration(
    maxLifetime: Duration(minutes: 5),
    maxCount: 2000,
  ),
);

When the log holds more than maxCount entries, the oldest are removed first.

User identifier

Attach your own user identifier to crash, error and bug reports, so you can find the reports of a specific user in the Dashboard:

AppeliumFeedback.setUserIdentifier('ABC-12345');
  • Call it after start, for example when the user signs in, and pass null when they sign out.
  • The identifier is limited to 50 characters; longer values are truncated.
  • Use an opaque ID from your own system rather than an email address or a name.

Backend environment

If your app can run against several backends, tell the SDK which one is in use. Network monitoring then lets you compare the performance of each environment and version:

AppeliumFeedback.setApplicationEnvironment(name: 'STAGING', version: '2.4.0');

The version is optional. Call it after start, and again whenever the app switches to another backend.

Simulators, emulators and debuggers

To keep production metrics representative, the SDK automatically turns off some features during development, even when they are enabled:

  • iOS Simulator and Android emulator: session monitoring and performance traces are not recorded. Crash reporting, error reporting and network monitoring still work.
  • Native debugger attached, such as Xcode's or Android Studio's: crash reporting, error reporting, network monitoring, session monitoring and performance traces are all disabled.

Bug reporting is not affected. To test crash reporting, build the app in release mode, open it from the home screen or the launcher, make it crash, and open it again to upload the report.

AppeliumFeedback.isDebuggerAttached completes with whether a native debugger is attached. The SDK checks once per process, so attaching a debugger to an app that is already running does not change it.

Permissions

On iOS, no Info.plist privacy keys are needed.

On Android, the SDK declares the permissions it needs, and your app gets them through the manifest merger. Android grants them at install, without a prompt:

  • android.permission.INTERNET, to send reports and metrics, also from release builds, which Flutter's templates leave without it;
  • android.permission.ACCESS_NETWORK_STATE, for the connection state and type;
  • android.permission.READ_BASIC_PHONE_STATE, for the cellular generation (2G to 5G) from Android 13.

InvocationEvent.screenshot works on Android from Android 14 and needs one more install-time permission. Add it to android/app/src/main/AndroidManifest.xml of the builds that use it:

<uses-permission android:name="android.permission.DETECT_SCREEN_CAPTURE" />

Call the SDK from native code

Your app's Swift and Kotlin code can call the native SDK too, for example to log from a native feature or to set a native obfuscation handler. Everything ends up in the same reports.

  • iOS: import AppeliumFeedbackKit in your Runner's code, and call the iOS API.
  • Android: add the native SDK to android/app/build.gradle.kts, with the version that your version of the package uses, named in its changelog, and call the Android API:

    dependencies {
        implementation("com.appelium:feedback:<feedback-version>")
    }
    

Never call the native start: the SDK starts when Dart calls AppeliumFeedback.start, and native calls before that are ignored. The native obfuscation handler is the exception, which you can set earlier.

Troubleshooting

  • The Android build fails with "minSdkVersion 24 cannot be smaller than version 28": raise your app's minSdk to 28.
  • Nothing reaches the Dashboard: check that at least one feature is enabled in start, that no native debugger is attached, and that each API key belongs to the application of its platform.
  • Changes to start have no effect: the SDK keeps the configuration of its first start across hot restarts. Stop the app and run it again.
  • An assertion fails with "Calls to … will be ignored": an SDK method ran before start, or outside the main isolate. Call start earlier in main.
  • Requests are missing from network logs: see which HTTP clients are captured.
  • Session metrics or traces are missing: they are not recorded on a simulator or an emulator. Test on a device without a debugger attached.
  • The iOS build cannot find the package's native code: Flutter's Swift Package Manager support is off. Turn it on with flutter config --enable-swift-package-manager.

Duplicate com.google.protobuf classes (Firebase)

If your app uses older Firebase plugins, the Android build can fail with Duplicate class com.google.protobuf… errors: Firebase's protolite-well-known-types before version 19.0.0 bundles the same classes as the protobuf-javalite library that the Appelium SDK uses. Update your Firebase plugins, or, if you cannot, leave protobuf-javalite out of your app in android/app/build.gradle.kts:

configurations.configureEach {
    exclude(group = "com.google.protobuf", module = "protobuf-javalite")
}

Only add it while another library provides the classes, such as an older Firebase. Without such a library, the classes would be missing at run time.