• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Cannot resolve symbol R

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Marshal
Posts: 3708
523
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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



 
Rancher
Posts: 4505
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 4505
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic