Cannot resolve symbol ViewModelProviders on AppCompatActivity

Hey I'm trying to get my ViewModel working, but no luck so far. Android Studio shows error Cannot resolve symbol 'ViewModelProviders'.

Every other question I found on this topic was correcting extends Activity to extends AppCompatActivity, but I am extending the right one. Not sure what I'm missing...
My code is based on This YouTube video

public class MainActivity extends AppCompatActivity implements
    TileAdapter.TileAdapterOnClickHandler {

private BaseViewModel viewModel;

protected void onCreate(Bundle savedInstanceState) {
    //set Toolbar
    Toolbar myToolbar = findViewById(;

    //initialize viewModel
    viewModel = ViewModelProviders.of(this).get(BaseViewModel.class);

public class BaseViewModel extends ViewModel {

private Movie[] mMovie;

public void init (Movie[] movies){
    this.mMovie = movies;

public Movie[] getMovie() {
    return mMovie;


  • I didn't have both dependencies in my build, hence the problem.

    implementation "android.arch.lifecycle:extensions:1.1.0"
    implementation "android.arch.lifecycle:viewmodel:1.1.0"

    Thanks @Muthukrishnan Rajendran