-2

I am using android 3.3.1. I am currently taking an android development boot camp online course on Udemy. After I cloned the project from GitHub to the android studio (bitcoin-ticker), after the Gradle files synchronize and the project is loaded, when I open the MainActivity in java, I get R in red saying cannot resolve symbol 'R'. I didn't see an R class files in the project. So, I cleaned and built the project, android studio generated automatically the r class. I still had the cannot resolve symbol 'R' error. I moved the generated r class file to the same package where MainActivity java is with no result. Here is a picture of what it looks. Does anyone know how can I get rid of the red R and get the project to compile?

Thanks in advance

enter image description here

Faysal Ahmed
  • 7,501
  • 5
  • 28
  • 50
David
  • 1
  • 3
    Possible duplicate of ["cannot resolve symbol R" in Android Studio](https://stackoverflow.com/questions/17054000/cannot-resolve-symbol-r-in-android-studio) – Md. Sabbir Ahmed Mar 04 '19 at 05:58
  • Is the sync successful? Can you build the project? Usually when the R class isn't resolved it means that resource compilation/linking failed. If your sync/build fails look at the errors and build log to figure out what's wrong. – Izabela Orlowska Mar 04 '19 at 10:27
  • Try to check all of your layouts. maybe there is an error in you res>Layout, check each xml file – jhayjhay Mar 20 '19 at 06:30

2 Answers2

0

Try one of this following may be solved your problem

  • rebuild the project if anything wrong or error will be show you in log then solve it

  • if not then invalidate cache and restart

s. srichomthong
  • 486
  • 5
  • 14
  • I just tried it and didn't work. The same. Still get the red R and the same error cannot resolve symbol 'R'. – David Mar 05 '19 at 05:24
-1

I am also new to Android Studio. But a simple search for the file has revealed that it is located at /Your_App_Name/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/com/example/Your_App_Name

Rahul
  • 205
  • 2
  • 8