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:
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>
In the Project view, click the module and press F4. Ignore the warning.
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?
- Press F4 into Project Structure, Check SDKs on left
- 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
Triggering Event When Button Is Pressed Down in Android
Adding Multiple Markers in Google Maps API V2 Android
Taking a "Screenshot" of a Specific Layout in Android
How to Use Default Android Drawables
Passing JSONobject into Another Activity
Android Sdk Content Loader Failing with Nullpointerexception
Inflate a View in a Background Thread
Google Play Services Missing in Emulator (Android 4.4.2)
How to Change the Group Owner in a Persistent Group in Wi-Fi Direct
How to Handle Basic Authentication in Webview
Noclassdeffounderror Below Sdk 21
Proxy Which Requires Authentication with Android Emulator
How to Download a Video File to Sd Card
Back to Main Activity from Notification-Created Activity
How to Display Images from a Specific Folder on Android Gallery