• Post Reply Bookmark Topic Watch Topic
  • New Topic

Cannot resolve symbol R  RSS feed

 
Josh Diamond
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Building my first android game and am getting "cannot resolve symbol R" (lines 31-39) on several java files for instance my EnemyShip class. Using Android Studio ver 2.3.3. I have enemy ship png's in my resources folder so don't really know why I'm getting this error.

 
Ron McLeod
Bartender
Posts: 1603
232
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
R is a generated class.  You may need to manually import it in to your code.

The R class should be in the top-level package for application.  For example, in my case the top-level package for the application is: com.mcleodnet.hflink, so my code imports: import com.mcleodnet.hflink.R



 
Norm Radder
Rancher
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The IDE takes care of building the R.java file.  Often an error in an XML file will cause the IDE not to generate the R.java file.  Check all the xml files for errors.
 
Josh Diamond
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Getting errors in my XML files lines 3-9 e.g. cannot resolve symbol @dimen/activity_horizontal_margin



Also getting errors here from lines 3-6 e.g. line 3 cannot resolve symbol @dimen/activity_horizontal_margin
 
Norm Radder
Rancher
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
cannot resolve symbol @dimen/activity_horizontal_margin

That value should be defined in the dimens.xml file in the res/values folder.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!