R file is missing in android. I had tried many solutions like clean project, rebuild project, sync Gradle but couldn't fix it.
Asked
Active
Viewed 491 times
-1

Phantômaxx
- 37,901
- 21
- 84
- 115
-
1are you able to run the app? Iam asking because, sometimes android studio simply complains but actually the app can be executed – Sagar Jun 09 '18 at 12:09
-
2when you have a successful build, you have R in your project. also check package names – Arash Hatami Jun 09 '18 at 12:09
-
1Try this https://stackoverflow.com/questions/17054000/cannot-resolve-symbol-r-in-android-studio/49465461#49465461 – RazvanParautiu Jun 09 '18 at 12:09
-
Android Studio won't build R file because of errors in one/many resource files, for instance unclosed tags. Check the xml files you modified last – randomuser Jun 09 '18 at 12:28
3 Answers
1
Check for all your XML files for any errors. Once error is resolved, try clean and then rebuild the project.

oj24031989
- 31
- 1
- 4
0
Slide out the Build Variants Tab and make sure you are on the expected build variant. If you are missing layout files in a certain build variant, then Android Studio will fail to build and the generated R class is unavailable.

Montwell
- 505
- 3
- 12
0
Firstly we should try to have internet while we are coding because IDE has to load many resources at this time. Secondly In that specific case I was loading a resource of type (v24). Third Resource name was in capital latter. Thats why it wasn't working properly.