Make sure R is in the same package as the file where you want to call it from. (or import the package in the source file)
To change the package of the R file open your App Manifest file and change packge="" to the same package as where your source files are in.