java.lang.IllegalArgumentException: The view is not associated with BottomSheetBehavior

I've solved it, and I want to post the answer in case someone else has the same problem, when you import the layout that contains the BottomSheet you must not include layout_width and layout_height:

<include layout="@layout/btmsht_principal"

so it has to be:

<include layout="@layout/btmsht_principal"/>

In Bottom sheet main content use:


In Main activity use with include layout app:layout_behavior=""

Your problem solved