0

every time I try to use something from my resources like a layout file

R.id.frameTwo

R cannot be found and android studio automatically puts android. before the R so it does not find any of my resources and I have errors all over the place.

the error is Cannot resolve symbol R

Why cant my resources be found?

tyczj
  • 71,600
  • 54
  • 194
  • 296
  • Can you post the specific error your getting? – Nick Nov 06 '13 at 02:38
  • @Nick `Cannot resolve symbol R` is the error I get – tyczj Nov 06 '13 at 02:39
  • Try a gradle clean and build? http://stackoverflow.com/a/18183656/864538 Is this a fresh project? – Nick Nov 06 '13 at 02:41
  • @Nick how do you do the gradle cean, the link does not really say. yes the project is new I just copied over a bunch of java and xml files over – tyczj Nov 06 '13 at 02:47
  • Open command prompt or terminal and cd to your project directory and run gradelw clean. Also which version of Android Studio are you running? – Nick Nov 06 '13 at 02:52

2 Answers2

0

Check that your package is correct at the top. Sometimes Android Studio does weird things. It could be:

package com.yourpackage.applicationname

Also check if there is an import statement with R in it. If there is remove it as it's not needed.

Nick
  • 676
  • 9
  • 22
0

You should import com.yourpackage.application.R.

If R.java isn't being properly generated, the problem is in your XML files. Figure out what's going wrong there.

blahdiblah
  • 33,069
  • 21
  • 98
  • 152