GetStream / stream-chat-android

:speech_balloon: Android Chat SDK ➜ Stream Chat API. UI component libraries for chat apps. Kotlin & Jetpack Compose messaging SDK for Android chat
https://getstream.io/chat/sdk/android/
Other
1.39k stars 263 forks source link

Not able to create any new channels. #5262

Closed Yatish1910 closed 1 week ago

Yatish1910 commented 2 months ago

Describe the bug When we are trying to create new channels with given members it is throwing error:

ThrowableError(message=, cause=java.lang.NoSuchMethodError: No direct method <init>(Lio/getstream/chat/android/models/User;Ljava/util/Date;Ljava/util/Date;Ljava/lang/Boolean;Ljava/util/Date;Ljava/util/Date;ZZLjava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V in class Lio/getstream/chat/android/models/Member; or its super classes (declaration of 'io.getstream.chat.android.models.Member' appears in /data/app/~~l85PiCK7TDUpT7K6K7sQZA==/edu.paletteeduworkspace.paletteapp-lT2tKVzHxD2_eTga3h3FyA==/base.apk!classes19.dex))

SDK version 6.3.2

To Reproduce This piece of code is to reproduce.

val uuid = UUID.randomUUID()
                            val channelId = uuid.toString()
                            client.createChannel(
                                channelType = "messaging",
                                channelId = channelId,
                                memberIds = listOf(currentUserId, id),
                                extraData = mutableMapOf(
                                    "networkId" to args.netId,
                                    "programUuid" to args.programId,
                                    "networkName" to SessionManager.getString(requireContext(),"NETWORK_NAME").toString(),
                                    "channel_type" to "normal",
                                    "isArchived" to archivedList(listOf(currentUserId,id))
                                )
                            ).enqueue {channelResult->
                                when(channelResult){
                                    is Result.Failure -> {
                                        Log.d("CreateChannel", channelResult.value.toString())
                                        requireContext().showLongToast(resources.getString(R.string.initiating_the_chat_will_be_available_soon))
                                    }
                                    is Result.Success -> {

                                        Log.d("CreateChannel", channelResult.toString())
                                        findNavController().navigate(
                                            CreateChannelFragmentDirections.actionCreateChannelFragmentToChattingFragment2(
                                                channelResult.value.cid,
                                                args.netId,
                                                args.programId,
                                                0,
                                                args.programName,
                                                channelResult.value.id,
                                                channelResult.value.hasUnread
                                            )
                                        )
                                    }
                                }

                            }

Expected behavior It should be able to create new channels.

Device:

Screenshots

vijay-anand-dev commented 2 months ago

Hi, is there any update regarding this bug?

skydoves commented 1 month ago

Hi @Yatish1910, @vijay-anand-dev, we're wondering if you still face the same issue after adding the proguard rules below following this guide:

https://github.com/GetStream/stream-chat-android?tab=readme-ov-file#%EF%B8%8F-r8--proguard

## Stream Chat Android Client Proguard Rules

# Classes that are using with QuerySort can't be minified, because QuerySort uses reflection. If the
# name of the fields of the classes being used by QuerySort, change, the sort won't work as expected.
-keep class io.getstream.chat.android.models.** { *; }
-keep class io.getstream.chat.android.client.api2.model.** { *; }

# ExtraDataDto can't be minified because we check for extraData using reflection in
# io.getstream.chat.android.client.parser2.adapters.CustomObjectDtoAdapter. If the name of extraData
# is changed, we will have problem with serialization.
-keep class * extends io.getstream.chat.android.client.api2.model.dto.ExtraDataDto {
    public kotlin.collections.Map extraData;
 }

# Rules necessary for R8 full mode
-keep class io.getstream.chat.android.client.api2.endpoint.** { *; }
-keep class io.getstream.chat.android.client.call.RetrofitCall { *; }
-keep class com.squareup.moshi.JsonReader
-keep class com.squareup.moshi.JsonAdapter
-keep class kotlin.reflect.jvm.internal.* { *; }

# Rules to improve the logs by keeping the names of the classes
-keep class * extends io.getstream.chat.android.client.clientstate.UserState

# Classes that are used by reflection.
-keep class io.getstream.chat.android.client.notifications.ChatPushDelegate { *; }
github-actions[bot] commented 1 week ago

This issue has been automatically closed because there has been no response to our request from the original author. Please don't hesitate to comment on the bug if you have any more information for us - we will reopen it right away! Thanks for your contribution.