stream-chat-android icon indicating copy to clipboard operation
stream-chat-android copied to clipboard

Not able to create any new channels.

Open Yatish1910 opened this issue 1 year ago • 2 comments

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:

  • Moto G52
  • 13

Screenshots

Yatish1910 avatar May 16 '24 13:05 Yatish1910

Hi, is there any update regarding this bug?

vijay-anand-dev avatar May 24 '24 11:05 vijay-anand-dev

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 { *; }

skydoves avatar May 31 '24 03:05 skydoves

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.

github-actions[bot] avatar Jul 17 '24 00:07 github-actions[bot]