“Cannot find symbol R” error after renaming package name

后端 未结 8 2412
深忆病人
深忆病人 2021-02-07 05:06

After renaming my project package name (with Refactor), I got this error:

Error:(7, 44) error: cannot find symbol class R

All of my R

8条回答
  •  心在旅途
    2021-02-07 05:35

    Seems like, you changed the application package name but didn't change the import statements. So look for import statement of class R. It must be like

    import .R;
    

    If it's not a problem with import statements then look whether the R.java file has generated or not. It generally doesn't get generated if there is a problem with the application layout(xml) files. The R class file is generated only when all your xml layout files are correct.

    Clean the project and check.

提交回复
热议问题