It was all going OK. A happy and speedy app development was going on in my mac. One day I got a notification about android studio update. After updating it, something gone crazy. A red error in all java and activity file about “cannot resolve symbol R”. It was too much annoying because although having this error the project was still compiling and building successfully and no error in app in run time. I made a heavy searching. But all the solution was suggesting that there might be some mistake in file name or error in drawable xml code. Some people wrote that “Invalidate cache and restart” is the solution and may more. I believe I followed these solutions 100 of times. But no luck.
This made me crazy. I had no idea what going on. This problem came out all of a sudden after the damn update. I thought OK, lets revert back to the previous version. I installed previous version again, but now I found an another strange behavior. I was unable to add the vector icon anymore from android studio asset store. It was an amazing error. After selecting the icon, renamed it, change the color and when I click on OK button nothing happens. No icon is adding in drawable folder. I check and and rechecked it. Nothing happens. But when I copy and past a drawable file it was working as expected. No problem. You believe me or not I have developed my project like this way for almost 7 days.
Finally I lost my patience. I downloaded the new version of android studio and reinstalled it. Found the same problem again. I created a whole new project and started to copy and paste all the files one by one. My god, At the last moment I found the mismatch in root level build.gradle file. It was using the
gradle version 3.3.0 . I changed it to the previous version to
3.2.1 . And the problem gone. To detect this error, it took almost 6.50 hours. And at last my happy developing started again.