bboett
bboett

Reputation: 133

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?

Upvotes: 0

Views: 2610

Answers (3)

Nikhil A A
Nikhil A A

Reputation: 441

After renaming the package, I had the same issue. I solved it by changing the package attribute in manifest tag in AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.www.main.activity" >

Upvotes: 3

E-Rock
E-Rock

Reputation: 26

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.

Upvotes: 0

user3387525
user3387525

Reputation:

Changes in your Build target also can effect R.java in Eclipse so

Right Click Project >> Properties >> Android >> Select Latest(usually) Android API Platform >> Click OK

I think, you may need to relaunch Android SDK Manager again and install a new item: Android SDK Build-tools.

enter image description here

After installing this, clean your projects and rebuild.Hope this is helpful.

Upvotes: 1

Related Questions