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?
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?
So I solved my problem
no Android Studio
was file
and then Project Structure
Thengotoapp
,inthePropertiesfieldinCompileSdkVersionandBuildToolsVersionselectthelatestversion.
Click OK and you're done.
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.
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.
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 .
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....