Error regenerating R.java file after refactoring (moving) a project folder in IntelliJ IDEA

偶尔善良 提交于 2019-12-25 03:54:49

问题


My current Android project structure in IntelliJ is free.nrw.commons, but I need to change it to fr.free.nrw.commons. I created the 'fr' folder and used the refactor tool to move 'free.nrw.commons' into the 'fr' folder, but this seemed to break the links to the layout files, for example resDialogText = R.string.crash_dialog_text produces the error 'cannot resolve symbol R'.

So I deleted the R.java file and regenerated it, but this did not solve the problem and I get the error Error:android-apt-compiler: [commons] invalid resource directory name: C:\Users\misao\Documents\GitHub\apps-android-commons\commons\res java when I try to rebuild.

I have also read similar StackOverflow threads and tried these steps, to no avail: (1) Invalidate cache and restart, and (2) Checked for any false android.R imports that might block regeneration.

Any help would be much appreciated.


回答1:


I found the reason for the problem. When doing the Refactor>Move, I needed to select the 'move entire directory' option, not the 'move package' option.



来源:https://stackoverflow.com/questions/32932497/error-regenerating-r-java-file-after-refactoring-moving-a-project-folder-in-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!