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 anSLRException.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
| Code | Description | Common cause | Fix |
|---|---|---|---|
SDK_IS_NOT_INITIALIZED | A 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_VALID | One 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_AUTHORIZED | The 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_VALID | The 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_RELEASED | An 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. |
UNKNOWN | An 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)
}
})| Level | Meaning |
|---|---|
VERBOSE | Fine-grained tracing, useful only when diagnosing a specific flow. |
DEBUG | Developer-facing detail about SDK state transitions. |
INFO | High-level lifecycle events (initialization, session creation). |
WARNING | The SDK recovered or skipped an optional step; integration may be misconfigured. |
ERROR | A 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.
| Symptom | Cause | Fix |
|---|---|---|
App crashes when StreamLayerFragment is created | The 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 only | ProGuard/R8 stripped or renamed SDK members. | Add keep rules for the SDK package. See Troubleshooting → ProGuard/R8. |
| StreamLayer Element renders blank | The 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 nothing | The 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
- Troubleshooting — Common integration issues and solutions
- Logging Interface — Capture and filter SDK log messages
- Integration Guide — Full Android SDK setup and configuration
Updated 3 months ago
