TroubleShooting
Troubleshooting Guide
Common issues with the Kasookoo Android SDK and how to resolve them.
Table of Contents
- Installation Issues
- Build Errors
- Authentication Errors
- Connection Issues
- Call Issues
- Audio Issues
- Push Notification Issues
- Performance Issues
- Debugging Tools
Installation Issues
"Could not find com.kasookoo:sdk-android"
Cause: Maven repository not added or sync failed.
Solutions:
-
Verify Maven repository in
settings.gradle.kts:maven { url = uri("https://maven.kasookoo.ai/releases") } -
Click Sync Project with Gradle Files (toolbar refresh icon)
-
File → Invalidate Caches & Restart
-
Try CLI sync:
./gradlew clean ./gradlew build --refresh-dependencies
"Manifest merger failed"
Cause: Conflicting permissions or services from different libraries.
Solutions:
-
Check error message for the specific conflict
-
Use
tools:replacein your manifest:<application tools:replace="android:icon,android:label" ... > -
Use
tools:removeto remove conflicts:<service android:name="conflicting.service" tools:node="remove" />
"Failed to resolve: com.google.firebase:firebase-bom"
Solutions:
-
Add Google Maven repository:
repositories { google() mavenCentral() } -
Verify internet connection and Maven Central access
-
Try using specific Firebase versions instead of BoM temporarily
Build Errors
"Duplicate class found in modules"
Cause: Multiple versions of the same dependency.
Solutions:
-
Run dependency tree:
./gradlew :app:dependencies -
Exclude conflicting transitive dependencies:
implementation("com.kasookoo:sdk-android:1.0.0") { exclude(group = "com.squareup.okhttp3") } -
Force specific versions:
configurations.all { resolutionStrategy { force("com.squareup.okhttp3:okhttp:4.12.0") } }
"Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 17"
Cause: Mixed JVM target versions.
Solution: Ensure all modules use JVM 17:
android {
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
}Build fails with R8/ProGuard errors
Cause: Code minification removing SDK classes.
Solution: Add ProGuard rules in proguard-rules.pro:
-keep class com.kasookoo.sdk.** { *; }
-keep interface com.kasookoo.sdk.** { *; }
-dontwarn com.kasookoo.sdk.**
-keep class io.livekit.android.** { *; }
-dontwarn io.livekit.android.**
-keep class org.webrtc.** { *; }
-dontwarn org.webrtc.**"Class XYZ not found"
Solutions:
- Clean build: Build → Clean Project
- Rebuild: Build → Rebuild Project
- Invalidate caches: File → Invalidate Caches & Restart
Authentication Errors
"Invalid publishable key"
Symptoms: KasookooError.InvalidKey thrown during initialize()
Causes:
- Wrong key format
- Expired key
- Wrong environment
Solutions:
-
Verify key format:
- Sandbox: starts with
pk_test_ - Production: starts with
pk_live_
- Sandbox: starts with
-
Check key in Kasookoo Dashboard:
- Make sure key isn't revoked
- Match environment to key type
-
Use correct environment in config:
KasookooConfig( publishableKey = "pk_test_...", environment = Environment.SANDBOX )
"Session expired" / 401 Unauthorized
Symptoms: API calls fail after working initially
Causes:
- Session TTL exceeded (default 10 minutes)
- Token refresh failed
- Backend session invalidated
Solutions:
-
SDK should auto-refresh. Check Logcat for refresh attempts.
-
Re-connect explicitly:
lifecycleScope.launch { sdk.disconnect() sdk.connect() } -
Re-initialize if needed:
lifecycleScope.launch { sdk.destroy() sdk.initialize(config) sdk.connect() }
"User identification failed"
Causes:
- Invalid email format
- Backend rejected user data
- User type mismatch
Solutions:
-
Validate email before sending:
if (!email.contains("@")) return -
Use valid
ParticipantType:CUSTOMER,AGENT,DRIVER,BOT,ADMIN
-
Check Logcat for specific rejection reason.
Connection Issues
"Failed to connect to backend"
Symptoms: connect() throws network exception
Causes:
- No internet connection
- Firewall blocking traffic
- Backend down
- Invalid base URL
Solutions:
-
Check internet connection:
adb shell ping -c 4 sdk.kasookoo.ai -
Verify environment URL:
// Sandbox environment = Environment.SANDBOX // → https://sdk-sandbox.kasookoo.ai // Production environment = Environment.PRODUCTION // → https://sdk.kasookoo.ai -
Check status.kasookoo.ai for outages
-
Check firewall — allow these domains:
*.kasookoo.ai*.livekit.cloud*.googleapis.com(Firebase)
"Token refresh failed repeatedly"
Symptoms: App keeps disconnecting
Causes:
- Clock skew (device time wrong)
- Backend changed JWT signing key
- Network instability
Solutions:
-
Verify device time is correct (Settings → Date & Time → Automatic)
-
Reset SDK state:
lifecycleScope.launch { sdk.destroy() sdk.initialize(config) } -
If issue persists, contact support with logs.
"CleartextTrafficException"
Cause: App tries to use HTTP instead of HTTPS.
Solutions:
- Use HTTPS endpoints only (Kasookoo enforces HTTPS by default)
- If you must allow cleartext for debugging:
<!-- AndroidManifest.xml --> <application android:usesCleartextTraffic="true" ... >
⚠️ Never use cleartext in production.
Call Issues
"Call fails immediately after start()"
Symptoms: Call goes from INITIATING to FAILED
Causes:
- Invalid callee
- Backend rejected call
- Insufficient permissions
Solutions:
-
Check error details:
lifecycleScope.launch { sdk.events .filter { it.name == EventName.CALL_FAILED } .collect { event -> Log.e("Call", "Error: ${event.data["errorMessage"]}") } } -
Verify callee has required info (name, email)
-
Check publishable key scopes include
webrtc
"Invalid state transition: X → Y"
Symptoms: Call state machine error
Causes:
- Calling
end()on already-ended call - Calling
accept()on outgoing call - Race condition
Solutions:
-
Check call state before action:
if (call.state != CallState.ENDED && call.state != CallState.FAILED) { sdk.call.end(callId = call.id) } -
Use SDK events to know when actions are valid
"LiveKit connection failed"
Symptoms: Call reaches CONNECTING then fails
Causes:
- LiveKit token expired
- Network blocking WebRTC
- LiveKit cloud issues
Solutions:
-
Verify network allows WebRTC:
- UDP 50000-60000 outbound
- TCP 443 outbound
- TURN servers reachable
-
Test on different network (cellular vs WiFi)
-
Check LiveKit status
Audio Issues
"Call connects but no audio"
Symptoms: State is CONNECTED but can't hear/be heard
Causes:
- Microphone permission denied
- Audio focus not granted
- Bluetooth routing issue
- Emulator (limited audio support)
Solutions:
-
Check microphone permission:
if (ContextCompat.checkSelfPermission( this, Manifest.permission.RECORD_AUDIO ) != PackageManager.PERMISSION_GRANTED ) { requestPermissions.launch(arrayOf(Manifest.permission.RECORD_AUDIO)) } -
Test on real device — emulator has limited audio
-
Check audio mode:
val audioManager = getSystemService(AUDIO_SERVICE) as AudioManager Log.d("Audio", "Mode: ${audioManager.mode}") Log.d("Audio", "Speaker: ${audioManager.isSpeakerphoneOn}") -
Force speaker output:
audioManager.mode = AudioManager.MODE_IN_COMMUNICATION audioManager.isSpeakerphoneOn = true
"Audio cuts in and out / poor quality"
Causes:
- Weak network signal
- Bandwidth constraints
- Background tasks consuming CPU
Solutions:
- Test on stable WiFi
- Close other apps using camera/microphone
- Check network speed (need 100 kbps+ stable)
- Update to latest LiveKit version
"Echo / feedback during call"
Causes:
- Both devices' speakers near each other
- Echo cancellation not working
Solutions:
- Use headphones on at least one device during testing
- Increase distance between devices
- Lower speaker volume
- Verify echo cancellation is enabled in audio session
"Bluetooth headphones not working"
Solutions:
-
Add BLUETOOTH_CONNECT permission (Android 12+):
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" /> -
Request runtime permission:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { requestPermissions.launch(arrayOf(Manifest.permission.BLUETOOTH_CONNECT)) }
Push Notification Issues
"FCM token not generated"
"Push received but no ConnectionService UI"
Causes:
- Payload format incorrect
- Phone account not registered
- MANAGE_OWN_CALLS permission missing
Solutions:
-
Verify payload includes:
{ "data": { "type": "incoming_call", "call_id": "...", "room_name": "...", "caller_name": "..." } } -
Register phone account at app startup (see Push Notifications Guide)
-
Verify permissions in Manifest
"Push works in foreground but fails in background"
Causes:
- Battery optimization killing app
- Doze mode interfering
- Manufacturer-specific app management
Solutions:
-
Use
priority: "high"in FCM payload -
Request battery optimization exception:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { val pm = getSystemService(POWER_SERVICE) as PowerManager if (!pm.isIgnoringBatteryOptimizations(packageName)) { val intent = Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS) intent.data = Uri.parse("package:$packageName") startActivity(intent) } } -
For Chinese phones (Xiaomi, Huawei, etc.), guide users to add app to "Protected Apps"
"POST_NOTIFICATIONS permission denied"
Cause: User denied permission on Android 13+.
Solutions:
- Re-request with explanation:
if (shouldShowRequestPermissionRationale(Manifest.permission.POST_NOTIFICATIONS)) { // Show dialog explaining why showRationaleDialog() } else { // Open app settings val intent = Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS) intent.putExtra(Settings.EXTRA_APP_PACKAGE, packageName) startActivity(intent) }
Performance Issues
"App memory keeps growing"
Causes:
- Coroutine scopes not cancelled
- Flow collectors not cancelled
- Strong references in callbacks
Solutions:
-
Use lifecycle-aware coroutines:
class MyActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) lifecycleScope.launch { // Auto-cancelled on destroy sdk.events.collect { handleEvent(it) } } } } -
Use
viewLifecycleOwner.lifecycleScopein Fragments -
Use
repeatOnLifecycle:lifecycleScope.launch { repeatOnLifecycle(Lifecycle.State.STARTED) { sdk.events.collect { handleEvent(it) } } }
"SDK uses too much battery"
Causes:
- Long-running calls without proper cleanup
- Background services running unnecessarily
- Wake locks held too long
Solutions:
- End calls properly when user navigates away
- Don't hold wake locks beyond call duration
- Use foreground service only during active calls
"App launches slowly"
Causes:
- SDK initialization blocking main thread
- Too many synchronous operations on launch
Solutions:
-
Initialize SDK off main thread:
class MyApplication : Application() { override fun onCreate() { super.onCreate() CoroutineScope(Dispatchers.IO).launch { sdk = KasookooSDK(this@MyApplication) sdk.initialize(config) } } } -
Defer SDK init until needed:
// Initialize when user logs in or makes first call
Debugging Tools
Enable Verbose Logging
val config = KasookooConfig(
publishableKey = "...",
organizationId = "...",
logging = LoggingConfig(
level = LogLevel.DEBUG, // VERBOSE, DEBUG, INFO, WARNING, ERROR
includeNetworkLogs = true,
includeStateChanges = true
)
)Inspect Events in Real Time
lifecycleScope.launch {
sdk.events.collect { event ->
Log.d("SDK", "📨 ${event.name} - ${event.data}")
}
}Network Debugging with Charles/Proxyman
- Install Charles Proxy on Mac/PC
- Configure Android device to use Charles as proxy:
- WiFi settings → Modify network → Proxy → Manual
- Hostname: Your PC IP
- Port: 8888
- Install Charles CA certificate on device:
- Browse to
chls.pro/sslfrom device - Install certificate
- Browse to
- Configure network security config in Android app:
<!-- res/xml/network_security_config.xml --> <network-security-config> <debug-overrides> <trust-anchors> <certificates src="user" /> </trust-anchors> </debug-overrides> </network-security-config>
LiveKit Debugging
Enable LiveKit verbose logs:
import io.livekit.android.LiveKit
import io.livekit.android.LogLevel
LiveKit.setLogLevel(LogLevel.DEBUG)Logcat Filtering
Filter Logcat for SDK logs:
adb logcat -s "KasookooSDK:V" "FCM:V" "Call:V"Crash Reports
Set up crash reporting (Firebase Crashlytics recommended):
dependencies {
implementation("com.google.firebase:firebase-crashlytics-ktx")
}Getting Help
If you can't resolve an issue:
Information to Include
When reporting issues, please provide:
- SDK version (e.g.,
1.0.0) - Android version (e.g., Android 14, API 34)
- Device model (e.g.,
Samsung Galaxy S24) - Android Studio version (e.g.,
Iguana 2023.2.1) - Kotlin version (e.g.,
2.0.0) - Gradle version (e.g.,
8.4) - Steps to reproduce
- Expected behavior vs actual behavior
- Logcat output (with sensitive data redacted)
- Configuration code (with publishable key redacted)
Where to Get Help
- 📧 [email protected] — Direct support
- 💬 Discord Community — Community help
- 🐛 GitHub Issues — Bug reports
- 📖 Documentation — Searchable docs
- 🚨 status.kasookoo.ai — Service status
Enterprise Support
Enterprise customers have access to:
- Dedicated Slack channel
- Priority response (4-hour SLA)
- Direct engineering escalation
- Video call support
Contact [email protected] to upgrade.
Updated 15 days ago
