'Wrong argument type for 'user' in argument bundle

I am trying to pass an ArrayList<Profile> from one fragment to another in a bundle using Navigation Graph, but when I click the event the app crashes and I get this log java.lang.IllegalArgumentException: Wrong argument type for 'user' in argument bundle. [Lcom.example.dota2statistics.data.models.byID.Profile; expected. I have tried by making my class a Serializable as well, but still getting the same error. What am I missing

Here the object I am trying to pass

@Entity(
    tableName = "profile"
)
@Parcelize
data class Profile(
    @PrimaryKey(autoGenerate = true)
    val accountId: Int,
    @SerializedName("avatar")
    val avatar: String,
    @SerializedName("avatarfull")
    val avatarfull: String,
    @SerializedName("avatarmedium")
    val avatarmedium: String,
    @SerializedName("cheese")
    val cheese: Int,
    @SerializedName("personaname")
    val personaname: String,
    @SerializedName("plus")
    val plus: Boolean,
    @SerializedName("profileurl")
    val profileurl: String,
    @SerializedName("steamid")
    val steamid: String
): Parcelable

Here how I am passing fromg one fragment to another

emptyHomeViewModel.playerByIDLiveData.observe(viewLifecycleOwner) { profile ->
                    if (profile != null) {
                        profilesList.add(profile)
                        bundle = Bundle().apply {
                            putSerializable("user", profilesList)
                        }
                        findNavController().navigate(
                            R.id.action_emptyHomeFragment_to_selectUserFragment,
                            bundle
                        )

And here the XML of the fragment that will receive the bundle

  <fragment
        android:id="@+id/selectUserFragment"
        android:name="com.example.dota2statistics.SelectUserFragment"
        android:label="fragment_select_user"
        tools:layout="@layout/fragment_select_user" >
        <argument
            android:name="user"
            app:argType="com.example.dota2statistics.data.models.byID.Profile[]" />
    </fragment>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source