错误IntelliJ IDEA的重构(移动)项目文件夹后重新生成R.java文件 [英] Error regenerating R.java file after refactoring (moving) a project folder in IntelliJ IDEA

查看:3443
本文介绍了错误IntelliJ IDEA的重构(移动)项目文件夹后重新生成R.java文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的IntelliJ目前Android项目的结构free.nrw.commons,但我需要将其更改为fr.free.nrw.commons。我创建了FR文件夹并使用重构工具来移动free.nrw.commons到FR文件夹,但是这似乎打破了链接到布局文件,例如 resDialogText = R.string.crash_dialog_text 产生错误无法解析符号R'。

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'.

所以我删除了R.java文件和再生,但是这并没有解决问题,我得到的错误错误:Android的易编译:[公共]无效的资源目录名称:C :\\用户\\ misao \\文档\\ GitHub的\\ APPS,Android的公共\\共享\\ java的水库当我尝试重建。

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.

我也看过类似的计算器线程,并试图这些步骤,都无济于事:
(1)高速缓存无效并重新启动,并
(2)经过任何虚假android.R进口可能会阻止再生。

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.

任何帮助将是非常美联社preciated。

Any help would be much appreciated.

推荐答案

我找到了这个问题的原因。当进行重构>移动,我需要选择移动整个目录选项,而不是搬家包选项。

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.

这篇关于错误IntelliJ IDEA的重构(移动)项目文件夹后重新生成R.java文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆