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 R.java 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.