Android Studio inline compiler showing red errors, but compilation with gradle works fine
The following steps helps Close your project, and in your project folder delete project/.idea Delete ~/.gradle folder. Open the project again. Everything should be solved.