Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drawables not changing after being replaced with others in the folders

I've created a new theme set for an app of mine, and decided I didn't need the old one anymore. So, I copied my new image files over the old ones, replacing all of them. I did this for all of my drawables folders. I then recreated R.java just in case, and rebuild my application.

For some reason, it's picking up the old images and displaying those. Alright, I thought, must be something in the memory / cache. I'll just wipe my emulator image and try again.

After doing so, the app still used the old pictures. I thought I must have made a mistake and checked the images in Eclipse, but it showed the new images there. I then took drastic matters and deleted the drawables folders. Ofcourse this caused my project to freak out so I quickly added the desired new pictures and rebuild the project. No errors showed up, and all pictures appeared changed in Eclipse.

But when running the app, the old pictures still showed. Except in some parts of the app. Out of 70 or so pictures that I used, only 2 were now displaying the new version. All the other ones are still showing the old pictures.

What can be going on here? I tried restarting my emulator, resfreshing the project, creating a new project using the old one as the source, restarting my phone, wiping all app data before installing the app, deleting all images and replacing them with the new ones, but nothing seems to work.

How can an app that contains new images, thats being run on a completely fresh emulator, still display images that have been deleted at least an hour earlier?

like image 650
Sander van't Veer Avatar asked Dec 08 '11 13:12

Sander van't Veer


2 Answers

Wipe your bin-folder to remove old compiled data.

like image 123
Jave Avatar answered Oct 30 '22 20:10

Jave


TL;DR: check your other drawable-xxxdpi folders for old versions too!

I had this same problem, and none of the solutions here helped. It was driving me crazy.

I had replaced res/drawable-hdpi/file.jpg with file.png. It was a different extension and had different content. Eclipse was seeing the new version, but no amount of cleaning/refreshing, uninstalling the app or manually deleting bin/gen folders made the device see the new version.

Then I realized that I had other versions in:

  • res/drawable-ldpi/file.jpg
  • res/drawable-mdpi/file.jpg
  • res/drawable-xhdpi/file.jpg

Once I replaced those versions with resized versions of file.png, then a simple re-run of the app fixed the issue. It seems like the Android resource compiler saw a "jpg" version of the file first in another of the drawable folders, then ignored the subsequent "png" version in drawable-hdpi. Even though the device it was running on was hdpi, the drawable was coming out of another dpi folder.

like image 26
foo64 Avatar answered Oct 30 '22 22:10

foo64