cometchat-android-v6-troubleshooting — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited cometchat-android-v6-troubleshooting (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Ground truth:com.cometchat:chatuikit-{compose,kotlin}-android:6.x(+calls-sdk-android:5.x) — resolved AAR (javap) +ui-kit/android/v6. Official docs: https://www.cometchat.com/docs/ui-kit/android/v6/overview · Docs MCP:claude mcp add --transport http cometchat-docs https://www.cometchat.com/docs/mcp(or fetch the URL directly without MCP). Verify symbols against the installed package/source before relying on them.
Companion skills: cometchat-android-v6-core (init/login), cometchat-android-v6-compose-theming, cometchat-android-v6-kotlin-theming, cometchat-android-v6-push
Diagnose and fix common issues with CometChat Android UIKit v6 across both Kotlin Views and Jetpack Compose stacks.
cometchat-android-v6-core)cometchat-*-components)| Symptom | Likely Cause | Fix |
|---|---|---|
Authentication null error on init | UIKitSettings not configured | Ensure setAppId() and setRegion() are called on builder |
APP ID null error on init | Missing app ID | Call setAppId("YOUR_APP_ID") on UIKitSettingsBuilder |
| Login fails with auth error | Invalid authKey or UID | Verify authKey from CometChat dashboard; check UID exists |
| Components show no data | SDK not initialized or user not logged in | Check CometChatUIKit.isSDKInitialized() and getLoggedInUser() |
| Compose components crash | Missing CometChatTheme {} wrapper | Wrap all CometChat composables in CometChatTheme {} |
| Views theme colors wrong | XML attrs not set | Inherit Activity theme from CometChatTheme.DayNight (see -kotlin-placement); for brand colors override cometchat* attrs in the Activity theme or call CometChatTheme.setPrimaryColor(...) |
IllegalArgumentException: The style on this component requires your app theme to be Theme.MaterialComponents (or a descendant) at MaterialCardView.<init> (typically from CometChatConversations.<init>) | Activity theme parent is Theme.AppCompat.* or android:Theme.* | Switch themes.xml parent to CometChatTheme.DayNight (NOT Theme.MaterialComponents.*.Bridge — Bridge drops Material widget defaults and triggers the MaterialButton crash below) |
UnsupportedOperationException: Failed to resolve attribute at index N at MaterialButton.<init> (during inflate of kit-internal layout) | Activity theme is Theme.MaterialComponents.* (or .Bridge) but missing cometchat* attrs | Switch themes.xml parent to CometChatTheme.DayNight — the kit's own theme supplies every cometchat* attr its internal layouts reference |
| Dark mode not applied (Compose) | Using lightColorScheme() always | Use if (isSystemInDarkTheme()) darkColorScheme() else lightColorScheme() |
| Dark mode not applied (Views) | Theme cache stale | Call CometChatTheme.clearCache() on configuration change |
| Messages not loading | User/Group not set on component | Call setUser(user) or pass user parameter before display |
| Push notifications not received | Missing google-services.json | Add file to app module root; verify Firebase project config |
| FCM token not registered | onNewToken() not called | Manually request token with FirebaseMessaging.getInstance().token |
| Call notifications not showing | VoIP permissions missing | Request READ_PHONE_STATE, MANAGE_OWN_CALLS, ANSWER_PHONE_CALLS |
| Calls SDK not initialized | enableCalling not set | Set setEnableCalling(true) on UIKitSettingsBuilder |
CometChatCalls class not found | Missing calls SDK dependency | Add com.cometchat:calls-sdk-android to dependencies |
Calls broken on chatuikit:6.0.0 (call button targets wrong user, in-call screen blank, etc.) | Known v6.0.0 calls defects — CometChatCallButtons captures the first-rendered user globally + 4 related bugs | Apply the 5 documented workarounds (W1–W5) in cometchat-android-v6-calls (§"Five required workarounds"). The kit ships broken for calls at 6.0.0 but works end-to-end with W1–W5 (validated on device). Don't hand-patch blind — use that section. |
| Build fails with duplicate classes | Conflicting annotation libs | Add exclude(group = "org.jetbrains", module = "annotations-java5") to configurations |
compileSdk error | SDK too low | Set compileSdk = 36 |
minSdk error | API level too low | Set minSdk = 28 — v6 requires Android 9.0+ |
| Compose preview crashes | Missing preview data | Use the preview/ package helpers for @Preview composables |
| WebSocket disconnects in background | No lifecycle management | Call CometChat.connect() on foreground, disconnect() on background |
| Recomposition issues | Unstable state in composables | Ensure state is hoisted properly; use remember and derivedStateOf |
| BubbleFactory not applied | Wrong factory key | Verify getCategory() and getType() match the message's category and type |
| Style not applied (Compose) | Using constructor instead of default() | Use StyleClass.default(param = value) not StyleClass(...) |
// Check initialization
Log.d("CometChat", "SDK initialized: ${CometChatUIKit.isSDKInitialized()}")
Log.d("CometChat", "Calls SDK initialized: ${CometChatUIKit.isCallsSDKInitialized()}")
Log.d("CometChat", "Logged in user: ${CometChatUIKit.getLoggedInUser()?.uid}")// ❌ Wrong: init in every Activity
class ChatActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
CometChatUIKit.init(this, settings, callback) // DON'T DO THIS
}
}
// ✅ Correct: init once in Application or splash
class MyApp : Application() {
override fun onCreate() {
super.onCreate()
CometChatUIKit.init(this, settings, callback)
}
}// ❌ Crash: CompositionLocal not provided
setContent {
CometChatConversations() // Will crash or look wrong
}
// ✅ Correct
setContent {
CometChatTheme {
CometChatConversations()
}
}// ❌ Unnecessary nesting
CometChatTheme {
NavHost(...) {
composable("chat") {
CometChatTheme { // Don't nest
CometChatMessageList(user = user)
}
}
}
}
// ✅ Single wrapper at top level
CometChatTheme {
NavHost(...) {
composable("chat") {
CometChatMessageList(user = user)
}
}
}// If colors are all 0/transparent, the XML attrs aren't set
// Fix: Set programmatically
CometChatTheme.setPrimaryColor(Color.parseColor("#6851D6"))
// Or add attrs to your Activity's theme in styles.xmlIf message list doesn't scroll properly, ensure the layout gives it flexible height:
<!-- ✅ Use layout_weight for flexible height -->
<CometChatMessageList
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />POST_NOTIFICATIONS is a runtime permission on API 33+ — declaring it in the manifest isn't enough.<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/> AND request it at runtime (ActivityCompat.requestPermissions(...) / the Activity Result API) before you expect notifications. Below API 33 it's granted implicitly.// When app is killed and FCM wakes it, SDK may not be initialized
override fun onMessageReceived(message: RemoteMessage) {
if (!CometChatUIKit.isSDKInitialized()) {
// Cannot handle message — show basic notification or skip
return
}
// Safe to proceed
}⚠️ `CometChatVoIP` is NOT a v6 kit/SDK API. It exists only as an app-local helper in the V5 sample app; the v6 sample even asserts it must not be referenced (PreservationPropertyTest.kt:78). Check the permissions directly withContextCompat.checkSelfPermission(or copy the V5 helper into your project if you want its convenience wrappers):
import androidx.core.content.ContextCompat
import android.content.pm.PackageManager
import android.Manifest
// All three permissions are required for VoIP calling
fun hasVoipPermissions(context: Context): Boolean {
val needed = listOf(
Manifest.permission.READ_PHONE_STATE,
Manifest.permission.MANAGE_OWN_CALLS,
Manifest.permission.ANSWER_PHONE_CALLS,
)
return needed.all {
ContextCompat.checkSelfPermission(context, it) == PackageManager.PERMISSION_GRANTED
}
}// In build.gradle.kts
configurations.all {
exclude(group = "org.jetbrains", module = "annotations-java5")
}// In settings.gradle
repositories {
maven { url = uri("https://dl.cloudsmith.io/public/cometchat/cometchat/maven/") }
}ClassNotFoundException on release buildsSymptom: App works in debug, crashes on release with java.lang.ClassNotFoundException: com.cometchat.uikit.compose... (or kotlin... package). R8 has stripped kit classes that look unused via reflection.
Fix: Add to app/proguard-rules.pro:
# Keep all CometChat UIKit and chat-sdk classes
-keep class com.cometchat.** { *; }
-keepclassmembers class com.cometchat.** { *; }
-dontwarn com.cometchat.**If you use the calls SDK, also add:
-keep class io.dyte.** { *; }
-dontwarn io.dyte.**BuildConfig field missing in releaseSymptom: BuildConfig.COMETCHAT_APP_ID resolves to empty string in release. Caused by local.properties not being copied during CI builds.
Fix: Provide credentials via Gradle properties from CI environment vars instead of relying on local.properties:
// app/build.gradle.kts
android {
defaultConfig {
buildConfigField(
"String", "COMETCHAT_APP_ID",
"\"${project.findProperty("cometchat.appId") ?: System.getenv("COMETCHAT_APP_ID") ?: ""}\""
)
// …same for region + authKey
}
}In CI (e.g. GitHub Actions), set COMETCHAT_APP_ID etc. as repository secrets, not as files.
isSDKInitialized() before making SDK calls in background services (FCM, VoIP)CometChatTheme {} — this is the #1 cause of Compose rendering issuesCometChatTheme.clearCache() in Views when the theme changes dynamicallyminSdk below 28 or compileSdk below 36~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.