Troubleshooting
Check Flutter SDK is loaded correctlyβ
You can use the PluginScreeb.debug() command in your code.
You will get contextual information in the debugging log about the running user session:
Debug targeting rulesβ
Since the targeting engine built by Screeb runs in the background, you may not understand which rules prevent your survey from being displayed to a user.
You can use the PluginScreeb.debugTargeting() command in your code.
You will get a list of available surveys and the associated targeting rules:
The rules with a green dot π’ are the ones that have been validated for this user. The rules with a red dot π΄ are not validated and may be the reason why your survey is not displayed.
Warning iOSβ
You won't see debug log on iOS if you didn't launch your app with xcode
SDK not initializingβ
If the SDK fails to initialize, check the following:
- Initialize after Flutter binding: Ensure
WidgetsFlutterBinding.ensureInitialized()is called before Screeb initialization:
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await PluginScreeb.initSdk("<YOUR-CHANNEL-ID>");
runApp(MyApp());
}
-
Channel ID: Verify your channel ID is correct. You can find it in the Screeb admin console.
-
Network permissions: Ensure platform-specific network permissions are configured.
Android - Add to android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
iOS - Add to ios/Runner/Info.plist if making HTTP requests:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
- Await initialization: Always await the
initSdkcall before using other Screeb methods:
await PluginScreeb.initSdk("<YOUR-CHANNEL-ID>");
// Now safe to use other Screeb methods
Survey or message not showingβ
If your survey isn't appearing when expected:
-
Targeting rules: Check targeting rules in the Screeb admin console. Use
PluginScreeb.debugTargeting()to see which rules are failing. -
User identification: Ensure the user is identified before triggering a survey:
await PluginScreeb.setIdentity("<USER-ID>");
// Wait for identity to be set before expecting surveys
- Initialization check: Verify the SDK is initialized before you expect surveys to display:
await PluginScreeb.initSdk("<YOUR-CHANNEL-ID>");
-
Survey status: Confirm the survey is published and active in the Screeb admin console.
-
Platform channels ready: Ensure the platform channel is initialized before triggering surveys. If calling Screeb methods very early, add a small delay:
await Future.delayed(Duration(milliseconds: 500));
await PluginScreeb.startSurvey("<SURVEY-ID>");
Survey not visibleβ
If a survey isn't appearing:
- WebView on Android: Ensure hardware acceleration is enabled (usually default). Check
android/app/src/main/AndroidManifest.xml:
<application
android:hardwareAccelerated="true"
...>
- iOS WebView configuration: If using WKWebView features, ensure proper configuration in your Info.plist.
Hot reload not reflecting Screeb changesβ
Screeb state is maintained in native code, so hot reload won't reflect changes to Screeb initialization or configuration:
- Full restart required: Use the hot restart button (π) or run:
flutter run
- Clean and rebuild if issues persist:
flutter clean
flutter pub get
flutter run
High memory usageβ
If you notice increased memory consumption:
- Avoid multiple initializations: Only call
PluginScreeb.initSdk()once, typically inmain():
void main() async {
WidgetsFlutterBinding.ensureInitialized();
// Initialize only once
await PluginScreeb.initSdk("<YOUR-CHANNEL-ID>");
runApp(MyApp());
}
- Close surveys when done: If you're manually controlling survey display, ensure proper cleanup:
// When navigating away or disposing
await PluginScreeb.closeSdk();
Crashes on app foreground/backgroundβ
Lifecycle-related crashes can occur if the SDK isn't properly initialized:
- Initialize in main(): Don't initialize Screeb in widget
initState()orbuild()methods. Always initialize inmain():
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await PluginScreeb.initSdk("<YOUR-CHANNEL-ID>");
runApp(MyApp());
}
- Handle app lifecycle: Use
WidgetsBindingObserverif you need to respond to app lifecycle events:
class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
@override
void initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
}
@override
void dispose() {
WidgetsBinding.instance.removeObserver(this);
super.dispose();
}
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
// Handle lifecycle if needed
}
}
Anonymous users inflating MTU countβ
If you're seeing too many anonymous users:
- Call resetIdentity() on logout: Reset identity when users log out:
Future<void> logout() async {
await PluginScreeb.resetIdentity();
// Your logout logic
}
- Avoid init in test environments: Don't initialize Screeb during tests:
void main() async {
WidgetsFlutterBinding.ensureInitialized();
if (!const bool.fromEnvironment('dart.vm.product')) {
// Only init in release builds
await PluginScreeb.initSdk("<YOUR-CHANNEL-ID>");
}
runApp(MyApp());
}
Platform channel errors on iOS simulatorβ
Some features may not work correctly on iOS simulator:
-
Use a real device: Features like session replay or certain WebView capabilities require a physical iOS device.
-
Check for platform-specific errors: Wrap platform calls in try-catch:
try {
await PluginScreeb.startSurvey("<SURVEY-ID>");
} catch (e) {
print('Screeb error: $e');
}
Build errors after adding Screebβ
If you encounter build errors:
Androidβ
- Kotlin version: Ensure compatible Kotlin version in
android/build.gradle:
buildscript {
ext.kotlin_version = '1.7.10' // or higher
...
}
- Minimum SDK version: Check
android/app/build.gradle:
android {
defaultConfig {
minSdkVersion 19 // Minimum required
...
}
}
- Clean and rebuild:
cd android
./gradlew clean
cd ..
flutter pub get
flutter run
iOSβ
- CocoaPods version: Ensure you're using CocoaPods 1.10.0 or higher:
pod --version
sudo gem install cocoapods
- Update pods:
cd ios
pod install --repo-update
cd ..
flutter run
-
Swift version: Ensure your project targets Swift 5.0 or higher in Xcode.
-
Minimum iOS version: Check
ios/Podfile:
platform :ios, '12.0' # Minimum required
Method channel errorsβ
If you see MissingPluginException or method channel errors:
- Stop and restart: Hot reload won't register native plugins. Do a full restart:
flutter run
- Clean Flutter cache:
flutter clean
flutter pub get
- Reinstall pods (iOS):
cd ios
rm -rf Pods Podfile.lock
pod install
cd ..
- Invalidate Android cache:
cd android
./gradlew clean
cd ..