Cannot resolve symbol 'photo_recycle_view'


#1

This is my PhotoGalleryActivity.java

public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_photo_gallery, container, false);

        mPhotoRecyclerView = (RecyclerView) v.findViewById(R.id.photo_recycle_view);
        mPhotoRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 3));

        return v;
    }

and dependency is

dependencies {
implementation fileTree(include: [’*.jar’], dir: ‘libs’)
implementation ‘com.android.support:appcompat-v7:27.1.1’
implementation ‘com.android.support.constraint:constraint-layout:1.1.2’
testImplementation ‘junit:junit:4.12’
androidTestImplementation ‘com.android.support.test:runner:1.0.2’
androidTestImplementation ‘com.android.support.test.espresso:espresso-core:3.0.2’
implementation ‘com.android.support:recyclerview-v7:27.1.1’

I added the recycle but, ‘cannot resolve symbol’ error doesn’t disappear.
Restart wasnt worked too


#2

Please check your layout file. Whether the id name is defined as “photo_recycler_view” instead?