Search code examples
androidandroid-studior.java-file

Android studio lost R after renaming


i had a working prototype when at one build i ran into a disk-full problem... removed the clutter on my HD and tried to re-organize my code a little bit. I didn't found at that moment the tip to force the display of the directory structure of the source tree by dropping a file on a directory of that (otherwise emtpy) tree and did the renaming and shifting by hand.....

grepped over the whole code to change all references, and started studio again, everything compiles, but i got the dreaded "package R does not exist" message...

i went over the archive of that type of question.... no error flags on the xml layout files i upgraded the ADK SDK to build 22.6, i removed the whole src/gen tree i added a new layout checked that R isn't imported i cleaned my build and re-build it

still, it won't compile due to that error i am at a loss what to try next to get it running again?


Solution

  • So I discovered that if you put something below another thing in the XML like this for example:

    android:layout_below"@id/something"
    

    It will kill your R.

    You can fix it by changing the code to this:

    android:layout_below"@+id/something"
    

    This kinda thing has been happening to me a lot lately.