Android SDK – Where is my file?

While developing MyTricks Notebook, I just found myself facing the typical error:

‘R cannot be resolved to a variable’

After some searches, and with the help of this tutorial and this other tutorial, i managed to solve it.

This is how i’ve made it:

– Removed all the conflictive lines (marked in red) in the code (.java files)

– Fixed all the errors inside xml files (layouts, strings, etc), so there were, for example, no ImageButtons with an “android:background” value that does not exist.

– Removed the Android.R import.

– Did “Clean”, and then  “Build all” in the project. Note that instead of clicking “Build project”, i clicked “Build all”

After that, i managed to have an file inside the “gen” folder. From now on, I can use the R object normally. Brought back the commented “conflictive” lines, and they now work.

It was something as silly as that, but was so difficult to find.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s