The following classes could not be instantiated:
androidx.fragment.app.FragmentContainerView
(Open Class, Show Exception, Clear Cache)Tip: Use
View.isInEditMode()
in your custom views to skip code or show sample data when shown in the IDE. If this is an unexpected error you can also try to build the project, then manually refresh the layout.Exception Details:
java.lang.UnsupportedOperationException: FragmentContainerView must be within a FragmentActivity to be instantiated from XML. at androidx.fragment.app.FragmentContainerView.<init>(FragmentContainerView.java:117) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:961) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:1123) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1097) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084) at android.view.LayoutInflater.inflate(LayoutInflater.java:682) at android.view.LayoutInflater.inflate(LayoutInflater.java:501)
This message was shown and layout preview was not shown in basic activity or other template accept empty activity.
Before this message, one message was shown about replacing fragment tag with fragmentcontainerview
. I fixed this and then the above message was shown. I have tried known solutions like rebuild, refresh layout and invalidate caches/restart, etc, but they didn't do the trick.