As stated here : https://developer.android.com/reference/androidx/lifecycle/ViewModelProviders
The ViewModelProviders class is deprecated.
Instead of viewModel = ViewModelProviders.of(this).get(GameViewModel::class.java) you should use
val provider = ViewModelProvider(this, ViewModelProvider.NewInstanceFactory()viewModel = provider.get(GameViewModel::class.java
As stated here : https://developer.android.com/reference/androidx/lifecycle/ViewModelProviders The
ViewModelProviders
class is deprecated. Instead ofviewModel = ViewModelProviders.of(this).get(GameViewModel::class.java)
you should useval provider = ViewModelProvider(this, ViewModelProvider.NewInstanceFactory()
viewModel = provider.get(GameViewModel::class.java