Error Reference

Errors thrown by the StreamLayer Android SDK, their causes, and how to fix them. Covers SLRException codes, log severity levels, and common runtime failures.

The StreamLayer Android SDK surfaces problems in two ways:

  • SLRException — a checked exception thrown by public SDK methods (annotated with @Throws(SLRException::class)). Each carries an SLRException.Code.
  • Log messages — emitted through the logging interface at a given SLRLogLevel.

For setup steps, see the Integration Guide. For wider integration problems, see Troubleshooting.


SLRException

io.streamlayer.sdk.SLRException is the top-level exception type for public SDK APIs. It exposes a code, an optional message, and an optional cause.

data class SLRException internal constructor(
    val code: Code,
    override val message: String? = null,
    override val cause: Throwable? = null
) : Exception(message, cause)

Because suspend functions such as createEventSession() can throw, wrap SDK calls in try/catch and branch on code:

import io.streamlayer.sdk.StreamLayer
import io.streamlayer.sdk.SLRException

lifecycleScope.launch {
    try {
        val session = StreamLayer.createEventSession(event.id, null)
    } catch (e: SLRException) {
        when (e.code) {
            SLRException.Code.SDK_IS_NOT_INITIALIZED ->
                Log.e(TAG, "Call StreamLayer.initializeApp() first", e)
            else -> Log.e(TAG, "createEventSession failed: ${e.code}", e)
        }
    }
}

SLRException.Code

CodeDescriptionCommon causeFix
SDK_IS_NOT_INITIALIZEDA public method was called before the SDK was initialized.StreamLayer.initializeApp() was not called, or was called after the screen that uses StreamLayerFragment.Call StreamLayer.initializeApp(context, sdkKey) in your Application.onCreate(), before any other SDK call. Verify StreamLayer.isInitialized() returns true.
ARGUMENT_IS_NOT_VALIDOne or more arguments passed to an SDK method are invalid.Empty, malformed, or out-of-range values — for example an empty eventId passed to createEventSession().Validate arguments before the call. Check the exception message for which argument failed.
USER_IS_NOT_AUTHORIZEDThe operation requires an authorized user and none is signed in.Calling a session or profile method before authentication, or after the session was logged out.Authenticate first (useAnonymousAuth() or authorizationBypass()), then retry. See Authentication Forwarding.
ORGANIZATION_IS_NOT_VALIDThe organization tied to the SDK API Key could not be resolved.An invalid, revoked, or wrong-environment SDK API Key, or no network access during setup.Verify the SDK API Key is active in StreamLayer Studio and that the device has network access.
MANAGED_GROUP_IS_RELEASEDAn operation was attempted on a managed group session that has already been released.Using an SLRManagedGroupSession after it was closed/released.Create a fresh session with createManagedGroupSession() before interacting with it.
UNKNOWNAn unclassified error occurred.An unexpected internal or transport failure; inspect cause.Inspect e.cause and the SDK logs. If it persists, report to support with the surrounding logs.

Source: io.streamlayer.sdk.SLRException


Log severity levels

When you attach an SLRLogListener, every message arrives with an SLRLogLevel. Use the level to decide what to surface or forward to your own logging pipeline. All SDK log messages use the Logcat tag StreamLayer.

StreamLayer.setLogListener(object : SLRLogListener {
    override fun log(level: SLRLogLevel, msg: String) {
        if (level == SLRLogLevel.ERROR) reportToCrashlytics(msg)
    }
})
LevelMeaning
VERBOSEFine-grained tracing, useful only when diagnosing a specific flow.
DEBUGDeveloper-facing detail about SDK state transitions.
INFOHigh-level lifecycle events (initialization, session creation).
WARNINGThe SDK recovered or skipped an optional step; integration may be misconfigured.
ERRORA required operation failed. Pair with the matching SLRException where one was thrown.

See the Logging Interface for setup, and StreamLayer.setLogcatLoggingEnabled(false) to silence the SDK's internal Logcat output.

Source: io.streamlayer.common.utils.SLRLogLevel


Common runtime failures

These are not SLRException codes — they are conditions that surface as crashes or no-ops during integration.

SymptomCauseFix
App crashes when StreamLayerFragment is createdThe SDK component builder depends on the application Context, which is unavailable until initialization.Call StreamLayer.initializeApp() before any layout that inflates StreamLayerFragment.
NoSuchMethodError for SDK methods in release builds onlyProGuard/R8 stripped or renamed SDK members.Add keep rules for the SDK package. See Troubleshooting → ProGuard/R8.
StreamLayer Element renders blankThe host Fragment is not in the RESUMED state, or the container has no dimensions.Ensure the hosting fragment is resumed and the FragmentContainerView has explicit size. See Troubleshooting.
createEventSession / auth calls silently do nothingThe SDK is not initialized — these methods early-return when isInitialized() is false instead of throwing.Confirm StreamLayer.isInitialized() is true before calling.

Still stuck?

If an error persists after applying the fix, attach an SLRLogListener, reproduce the issue, and contact [email protected]. Include the SDK version (reported in the StreamLayer Logcat tag at initializeApp) and the surrounding log lines.


Related