Cannot resolve symbol 'recyclerView'

I’m on Listing 20.7 Configuring RecyclerView (

The compiler won’t recognize the recyclerView symbol field for binding.
A copy and paste is shown below, see the line of code that reads …
binding.recyclerView.setLayoutManager( new GridLayoutManager(getActivity(),3));

What am I doing wrong??


import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;


public class BeatBoxFragment extends Fragment {
public static BeatBoxFragment newInstance() {
return new BeatBoxFragment();

public View onCreateView(LayoutInflater inflater,
                         ViewGroup container,
                         Bundle savedInstanceState) {
    FragmentBeatBoxBinding binding = DataBindingUtil
            .inflate( inflater, R.layout.fragment_beat_box, container, false);

    binding.recyclerView.setLayoutManager( new GridLayoutManager(getActivity(),3));

    return binding.getRoot();


I’m getting the same issue. Anyone found the fix for this?

Just restarted Android Studio and the “Cannot resolve symbol” error went away for me.

I added compile ‘’ under dependencies in my build.gradle file and it worked.

1 Like

I had the same issue. I changed my keywords from “implement” to “compile” on my gradle build file to make it work.

In my case, just add the below line in to build.gradle file:
implementation ‘’