How to fix this "Error can not resolve symbol R" error in Android Studio

7

I imported a project in Eclipse to Android Studio and there were errors in the code regarding R with the following message

  

can not solve symbol R

How can I fix this error?

    
asked by anonymous 24.06.2015 / 15:28

6 answers

5

So I solved my problem

no Android Studio was file and then Project Structure

Thengotoapp,inthePropertiesfieldinCompileSdkVersionandBuildToolsVersionselectthelatestversion.

Click OK and you're done.

    
05.07.2015 / 18:23
4

This is not the root of the problem. R is an automatically generated class, but only when the project has no errors that could prevent it from being generated. Go to Window -> Show view -> Problems and see what other errors are happening.

After resolving these other errors, clean the project so that R is regenerated.

    
24.06.2015 / 15:47
3

I often came across this error, try giving "clean" and "rebuild" to the project. other options are:

"Tools" - > "Android" - > "Sync Project with Gradle Files"

If none of these solutions meets your error, enter the time-consuming but necessary process of verifying your XML files and your AndroidManifest.

    
23.07.2015 / 16:10
1

This problem is about something wrong inside the "res" folder, most of the time, the name of the images or anything else they have there do not conform to the rules of the compiler, to do the test, cut out everything you have there and put it elsewhere and see if it solved the problem, if so, look for all the items which is with some name not allowed, for example, starting with capital letter, ifem or something like this .

    
06.07.2016 / 00:42
1

If the error persists even after following all the suggestions above, do the following. Change the view mode from Android to Project soon you will see some unknown folders and in the root, (in my is the first folder) will have a .gradle, can delete it and a clean in the project.

    
03.10.2017 / 20:36
0

Team, who could not solve by following the above options, follows the step that helped me to correct the problem.

Click Run > Edit Configurations.

ThenclicktheJARApplicationoptionandsetJREandSearchsources...astheimage,clickOK,andthenclickBuil>CleanprojectandthenMakeProject.Formeitworkedcorrectly....

    
08.06.2018 / 01:59