I tried cleaning and rebuilding my project but it didn't help. I also don't have any errors in my XML file. When I run the app it works but R class stays in red. Please help me.
Asked
Active
Viewed 77 times
-2
-
File->Invalidate cache and restart – Doc Apr 17 '19 at 06:58
-
Also, try to make the project @Shams – Abhishek Bhardwaj Apr 17 '19 at 06:59
-
You might have androidX related issue, please migrate to latest version of android studio, – Amit Prajapati Apr 17 '19 at 07:00
-
Its Probably a gradle Version issue . See https://stackoverflow.com/questions/53360220/android-studio-cannot-resolve-symbol-r-but-project-compiles-and-runs.. – ADM Apr 17 '19 at 07:23
2 Answers
1
It happens sometimes do:
File -> Invalidate Caches/Restart
Also "Sync with file system" or "Sync project with Gradle files" might help

Antonis Radz
- 3,036
- 1
- 16
- 34
0
Thanks guys. I solved this problem change gradle version. classpath 'com.android.tools.build:gradle:3.2.0' in build.gradle

Shams
- 388
- 1
- 2
- 13