Jonathan Wareham
Jonathan Wareham

Reputation: 3399

Eclipse - Android drawable image resources not refreshing

I'm using Eclipse (4.2.1 Juno) on Windows 7 for my Android 2.2 project. I have several PNG resources in my drawable folders, and I'm finding that if I edit my PNG files (Paint/Photoshop etc) Eclipse doesn't recognise the file has changed and the ADT graphical layout designer still displays the old version of the image. I've tried refreshing the project folders list, tried doing a Project->Clean but neither has any affect. The only way I've found of getting Eclipse to recognise the new image version is to exit completely and restart which is a pain.

Is there some setting I can use to tell Eclipse not to 'cache' the images and always read the latest version off disk?

Upvotes: 3

Views: 5604

Answers (5)

Enyby
Enyby

Reputation: 4420

Resources cached in bin\res folder.

  1. Create script which delete folder bin\res with all content.

  2. Add this script as external tool in builder list.

  3. Set position in builder list - after CDT builder. Second position in list. If no CDT builder - set it first.

  4. Enjoy.

Upvotes: 0

Sean Gugler
Sean Gugler

Reputation: 779

I don't know of an automatic setting, but I have found a relatively simple manual action that seems effective. I was having the same trouble as you; now the following procedure seems to work consistently for me, with Eclipse Juno 4.2.1.

Click on the "res" folder to select it, then press F5 to refresh. Also make sure your PNG file timestamps have been touched.

Upvotes: 0

hakki
hakki

Reputation: 6521

Try in Eclipse Project -> Clean then select your project. This will delete your R.java file and will generate new one.

Upvotes: 5

kaushal trivedi
kaushal trivedi

Reputation: 3443

you should try saving all the unsaved resources and files after adding images ,than try out again.try cleaning both options with cleaning your single working project and with cleaning all projects.

Upvotes: 0

koljaTM
koljaTM

Reputation: 10262

That is a common problem of Eclipse that it doesn't recognize external changes for files in the workspace. The only thing I have found out to remedy this problem a little (apart from refreshing like crazy), are the refresh settings in external tools configurations. That is, if you run for example an Ant build, you can tell eclipse to refresh the workspace or specific resources afterwards. I don't know of any automatic way to do this though.

Upvotes: 1

Related Questions