简体   繁体   中英

How do I fix “unknown entity 'R' ”?

I am using AIDE on my Nexus 7 and suddenly I am unable to build / run my App. I get 18 errors of this kind and yes I've already tried turning it off and on again.

Check your namespaces (package name) and also folder structure.

I had this error when I change namespace of *.java files, and forget make namespace change also in build.gradle file of project (android - defaultConfig - applicationId). AIDE then try to import non-existent R, and shows the error, because generated resources are in another namespace (package).

Another option is to go to main menu in AIDE then "more..." - "code" - "organize imports" and see what choices you have to choose for importing R.

删除自动生成的 build/ 文件夹和 build.gradle 文件,我能够再次构建但不能安装(没有详细信息),不得不重新创建一个新的应用程序项目和回拷源和资源。

当您更改包名称并忘记更新应用程序的build.gradle文件中的applicationId时,就会发生这种情况。

Goto your project (In File Browser) and delete the build folder and do a rebuild. I had the same problem and is fixed

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM