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.
-
always post the Logcat for your errors , and R cannot be resolved error is related to resource errors. – Arash GM Jul 20 '14 at 06:17
-
Make sure that the xml files do not have an error. This error could be in your layout files, or the String resources etc as Arash pointed out – Shivam Verma Jul 20 '14 at 06:24
-
I can't post my LogCat if I can't run it. – user3857111 Jul 20 '14 at 06:25
-
AIDE does not show any other errors so my code and xml files must be OK – user3857111 Jul 20 '14 at 06:27
-
@user3857111 you have an error in xml file, check all layout, shape , manifest , menu and ... – Shayan Pourvatan Jul 20 '14 at 06:30
-
@shayanpourvatan I can't find any and also if I add new errors they show up instantly. – user3857111 Jul 20 '14 at 06:55
-
make sure, you don't have an import ...R; in your source code. Perhaps also one of these links help: http://stackoverflow.com/questions/885009/r-cannot-be-resolved-android-error http://www.techrepublic.com/blog/software-engineer/a-comprehensive-troubleshooting-guide-for-androids-r-cannot-be-resolved-error/ – quant Jul 20 '14 at 11:05
4 Answers
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.
Removing the autogenerated build/ folder and build.gradle file i was able to build again but not to install(with no details), had to recreate a fresh app project and copyback sources and resources.

- 11
- 2
This will happen when you change the package name and forget to update the applicationId in the app's build.gradle file.

- 443
- 4
- 9
-
Fixing the build.gradle file is the right way to do it. See https://stackoverflow.com/questions/35027651/aide-unknown-entity-r-error-with-android-studio-app-project/47593932#47593932 – Protean Jan 17 '18 at 14:17
Goto your project (In File Browser) and delete the build folder and do a rebuild. I had the same problem and is fixed

- 335
- 3
- 12