Skip to main content
Version: Android SDK

Troubleshooting

Check Android SDK is loaded correctly​

You can use the Screeb.debug() command in your code.

You will get contextual information in the debugging log about the running user session:

Capture d’écran 2023-02-08 aΜ€ 15 54 43

ℹ️ Output is printed with info log level.

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 Screeb.debugTargeting() command in your code.

You will get a list of available surveys and the associated targeting rules:

Capture d’écran 2023-02-08 aΜ€ 15 54 20

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.

ℹ️ Output is printed with info log level.

Error cases​

  • An empty channel id means you didn't call the initSdk method.
  • An empty respondent id means you exceeded your respondent quota.

SDK not initializing​

If the SDK fails to initialize, check the following:

  1. Main thread initialization: Ensure Screeb.initSdk() is called on the main/UI thread, typically in your Application.onCreate():
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
Screeb.initSdk(this, "<YOUR-CHANNEL-ID>")
}
}
  1. Channel ID: Verify your channel ID is correct. You can find it in the Screeb admin console.

  2. Network permissions: Ensure your AndroidManifest.xml includes internet permission:

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

Survey or message not showing​

If your survey isn't appearing when expected:

  1. Targeting rules: Check targeting rules in the Screeb admin console. Use Screeb.debugTargeting() to see which rules are failing.

  2. User identification: Ensure the user is identified before triggering a survey:

Screeb.setIdentity("user-123")
// Wait for identity to be set before expecting surveys
  1. Display hooks: If you use the onSurveyDisplayAllowed hook, ensure it returns true when the survey should be displayed:
Screeb.initSdk(
this,
channelId,
hooks = hashMapOf(
"version" to "1.0.0",
"onSurveyDisplayAllowed" to { _: Any -> true }
)
)
  1. Survey status: Confirm the survey is published and active in the Screeb admin console.

WebView not visible or blank widget​

If surveys appear blank or aren't visible:

  1. Z-index conflicts: Check for overlapping views in your layout hierarchy. Ensure no views are covering the Screeb WebView.

  2. Hardware acceleration: Enable hardware acceleration in your manifest (usually enabled by default):

<application
android:hardwareAccelerated="true"
...>
  1. WebView initialization: Ensure WebView is properly initialized. Check logcat for WebView errors:
adb logcat | grep -i "chromium\|webview"

High memory usage​

If you notice increased memory consumption:

  1. Avoid multiple initializations: Only call Screeb.initSdk() once, typically in Application.onCreate():
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
// Initialize only once
if (!screebInitialized) {
Screeb.initSdk(this, channelId)
screebInitialized = true
}
}

companion object {
private var screebInitialized = false
}
}
  1. Clear resources: Call Screeb.closeSdk() when appropriate, such as when the user logs out:
Screeb.closeSdk()

Crashes on app foreground/background​

Lifecycle-related crashes can occur if the SDK isn't properly initialized:

  1. Initialize after Activity creation: Don't call Screeb.initSdk() before the Activity is fully created.

  2. Handle lifecycle properly: Ensure your Application or Activity is handling lifecycle events correctly:

class MyActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
// Safe to use Screeb here
}
}

Anonymous users inflating MTU count​

If you're seeing too many anonymous users:

  1. Call Screeb.resetIdentity() on logout: Reset identity when users log out:
fun logout() {
Screeb.resetIdentity()
// Your logout logic
}
  1. Avoid init in test environments: Don't initialize Screeb in test or CI environments:
if (!BuildConfig.DEBUG && !isRunningTests()) {
Screeb.initSdk(this, channelId)
}

Missing ProGuard/R8 rules​

If you're using code minification (ProGuard or R8) and experiencing issues, add these keep rules to your proguard-rules.pro:

# Keep Screeb SDK classes
-keep class app.screeb.** { *; }
-keepclassmembers class app.screeb.** { *; }

# Keep WebView JavaScript interface
-keepclassmembers class * {
@android.webkit.JavascriptInterface <methods>;
}

Build errors after adding Screeb​

If you encounter build errors:

  1. Kotlin version: Ensure you're using a compatible Kotlin version (1.5.0 or higher).

  2. Android SDK version: Minimum SDK version is 19 (Android 4.4 / API 19). Check your build.gradle:

android {
defaultConfig {
minSdk 19
targetSdkVersion 33
...
}
}
  1. Dependency conflicts: Check for conflicting dependencies. Run:
./gradlew app:dependencies
  1. Clean and rebuild: Try cleaning your project:
./gradlew clean
./gradlew build