TimSim
TimSim

Reputation: 4036

Cleaning messed up my Android project

I changed some images in drawable-xxhdpi folder from jpg to png (by deleting jpg and copying png). When I started Eclipse, the error reported was:

res\drawable-xxhdpi-v4\stripes.png:0: error: Resource entry stripes is already defined. res\drawable-xxhdpi-v4\stripes.jpg:0: Originally defined here.

So I look that up and it says I should do Project>Clean, so I do, and now all .java files are are reporting errors on every line where R.something is used, for example:

setContentView(R.layout.activity_about);

reports error R cannot be resolved to a variable.

Then I looked this up and the problem is said to be xml errors, but:

  1. I didn't touch any of the xml files, I just changed jpgs to pngs
  2. none or the xml files have errors reported anywhere

Upvotes: 1

Views: 56

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317342

You can't have two resources of the same type with the same base name. You have these two right now:

res\drawable-xxhdpi-v4\stripes.png
res\drawable-xxhdpi-v4\stripes.jpg

They have the same base name "stripes" but with different extensions.

When the Android tools build your app, the name of the resource in your R class only contains the base name of your resource, but it will complain if two resources have the same base name.

You just need to give one of them a different base name so they can have two different resources defined.

Upvotes: 1

Related Questions