This guide covers the breaking changes in CometChat Android SDK v5 and what you need to update in your app.Documentation Index
Fetch the complete documentation index at: https://cometchat-22654f5b-docs-android-v6-beta2.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Dependency Update
Update yourbuild.gradle dependency:
Breaking Changes Overview
SDK v5 removes the Gson dependency from all SDK model classes and changesequals() / hashCode() to structural (deep) equality. All SDK model classes now implement Parcelable.
Must Do (will crash without these)
Replace Gson deserialization of SDK classes
Gson().fromJson(json, BaseMessage::class.java) no longer works because SDK classes no longer have Gson annotations.
Before (v4):
Conversation:
Before (v4):
Replace Gson-based Intent/Bundle passing
All SDK model classes (User, Group, BaseMessage, Conversation, etc.) now implement Parcelable. Use putExtra() / IntentCompat.getParcelableExtra() instead of Gson serialization.
User
Before (v4):BaseMessage
Before (v4):Group
Before (v4):Conversation
Before (v4):This pattern applies to all SDK model classes —
Call, Action, MediaMessage, TextMessage, CustomMessage, etc. They all implement Parcelable in v5.Replace Gson clone hacks
Before (v4):Must Do (will cause silent bugs without these)
Update DiffUtil comparisons
equals() now does deep structural comparison. Using it in areItemsTheSame() will cause incorrect diff results.
Before (v4):
Replace list contains/remove with ID-based operations
Before (v4):Stop using SDK objects as HashMap/HashSet keys
Before (v4):Add ProGuard keep rules
Add the following to yourproguard-rules.pro:
Should Review
These won’t crash but may cause unexpected behavior if your code relied on the old identity-based equality:- Any code that relied on
user1.equals(user2)meaning “same user” — it now means “identical in every field” - Any code that relied on
message1.equals(message2)meaning “same message” — it now means “identical in every field including read receipts, reactions, etc.” - Any code comparing Conversations via
equals()— now does recursive deep comparison oflastMessageandconversationWith
Safe — No Changes Needed
These patterns continue to work without modification:- Gson usage for your own custom DTOs (not SDK classes)
User.fromJson(),Group.fromJson(),BaseMessage.processMessage()— these SDK methods still workuser.toJson(),group.toMap()— these SDK serialization methods still work