I followed the official documentation to setup a TabLayout with ViewPager2. I used the TabLayoutMediator this way to connect the TabLayout with the ViewPager2:
I had the same similar problem, you need to set the viewPager adapter to null inside onDestroyView , then possible if you are using databinding make sure u set the binding to null. Goodluck