The simple option for the next several months is to stick with stable or beta versions. ViewModelProviders is only deprecated starting with 2.2.0, presently in an alpha03 release.
For when you do move to 2.2.0 or higher of the lifecycle dependencies, your options depend on your language:
If you are using Java, use the ViewModelProvider() constructor, passing in your activity or fragment
If you are using Kotlin, there is supposed to be a by viewModels() property delegate, though I am not finding it in the source code...
ViewModelProviders.of() has been deprecated. You can pass a Fragment or FragmentActivity to the new ViewModelProvider(ViewModelStoreOwner) constructor to achieve the same functionality. (aosp/1009889)
Instead of ViewModelProviders we should now use ViewModelProvider constructors and it has three:
public ViewModelProvider(ViewModelStoreOwner owner)
public ViewModelProvider(ViewModelStoreOwner owner, Factory factory)
public ViewModelProvider(ViewModelStore store, Factory factory)
1. If you are not using a ViewModelProvider.Factory to pass additional arguments to your ViewModel, you can use the first one. so:
viewModel = new ViewModelProvider(this).get(YourViewModel.class);
AppCompatActivity and different kinds of Fragments are indirect subclasses of ViewModelStoreOwner (see the complete list of its known subclasses here), so you can use them in this constructor.
2. But if you are using a ViewModelProvider.Factory, you should use the second or the third constructors:
// With ViewModelFactory
val viewModel = ViewModelProvider(this, YourViewModelFactory).get(YourViewModel::class.java)
//Without ViewModelFactory
val viewModel = ViewModelProvider(this).get(YourViewModel::class.java)