Android Studio “cannot resolve symbol R” but project compiles and runs

For some reason that i do not understand ,

this combination of build versions made the issue :

grade version = 4.10.1

classpath 'com.android.tools.build:gradle:3.4.0-alpha01'

when i switched to these build versions :

grade version = 4.6

classpath 'com.android.tools.build:gradle:3.2.1'

The issue was solved !


  1. File -> Close project
  2. Open an existing Android Studio Project
  3. Open you project

Hope it will work.


sometimes, R file is not generated because of package name on android manifest is not match with package module that you have.