0

I imported the v7-appcompat support library following the instructions on the android developer site, and ran into the missing R issue that many other users have encountered. I've read through several similar questions users have posted here, and tried what was suggested but I'm still getting the missing R problem. I've re-imported the appcompat library, cleaned my project, restarted eclipse, changed my min and target SDK in both the manifest and properties, and still have the same issue. The exact error regarding R is "R cannot be resolved to a variable".

Also, the attrs xml file in the values folder has an error that also showed up when I added the library but nobody else has mentioned. This is the code in the file:

<declare-styleable name="ButtonBarContainerTheme">
    <attr name="buttonBarStyle" format="reference" />
    <attr name="buttonBarButtonStyle" format="reference" />
</declare-styleable>

The error Eclipse is giving me is "error: Attribute 'buttonBarStyle' has already been defined". Any help with this would be greatly appreciated!

Community
  • 1
  • 1
CheeseCoder
  • 701
  • 1
  • 7
  • 11

1 Answers1

3

It sounds like your styleable is defined in your project RES folder. That styleable is also defined in the v7 support library, so it is now defined twice. Remove it from your RES xml.

See this post: Build errors after adding fullscreen activity in Android Studio

Community
  • 1
  • 1
Jim
  • 10,172
  • 1
  • 27
  • 36
  • This removed all the errors from my project, thanks! Out of curiosity, do you know why this file was causing me to get the R errors on my other files? I understand that there were duplicate files, but why was that affecting the R.java file? – CheeseCoder Jan 14 '14 at 21:37
  • 1
    When your RES file(s) fail to build, R.java is not generated during the build process, so any file(s) that depend on R.java get errors. – Jim Jan 14 '14 at 21:39