I am using navigation architecture component library and my app's starting point is this fragment:
class MainFragment : BaseFragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_main, container, false)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}
}
Which inherits from an abstract class which is BaseFragment:
abstract class BaseFragment : Fragment() {
}
When I run my app I get:
Unable to instantiate fragment io.example.MainFragment: calling Fragment constructor caused an exception
But this does not happen if MainFragment extends Fragment instead of BaseFragment. What is the reason? Does this have something to do with how the Navigation Architecture Component works?