Android Studio Cannot Resolve R in Imported Project

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 !

Android Studio: cannot resolve symbol R after importing Project from Github and rebuilding/cleaning/syncing with gradle files

Brotherrrrrr, your project uses the 3.3.1 release of the Android Gradle plugin.
Make sure you are using Android Studio 3.3.1 aswell.

Greetings,

Your brotherrrrr

Android Studio marks R in red with error message cannot resolve symbol R, but build succeeds

Here is my temporary solution until I find a better one:

  1. Using Everything, find where R.java is created. In my case it was
    C:\Program Files (x86)\Android\android-studio\system\compiler\<project-name>.cb969c52\.generated\aapt\<module-name>.6badd9a4\production\com\<project-name>\<module-name>

  2. In the Project view, click the module and press F4. Ignore the warning.

  3. Click "+ Add Content Root" and select the aforementioned folder. Make sure it's marked in blue (as a source).

After I did this, suddenly all the warnings are gone. The problem is that if you collaborate with other people, the folder name is different on each machine so be careful when synchronizing.

Android Studio cannot resolve R in imported project?

  1. Press F4 into Project Structure, Check SDKs on left
  2. Click Modules ---> Source Tab, check gen and src as sources

PS: The answer over a year old and the menus have changed.

Cannot Resolve Symbol 'R' Android Studio 3.0

Happened to me too after updating Studio and Gradle version. Even when the problem is in resource files, sometimes it might fail to indicate that. In such a scenario just close the project and import it afresh. That worked for me. The answers and comments in this question provide more details: https://stackoverflow.com/a/49537464/1877184



Related Topics



Leave a reply



Submit