简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM