Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse Android won't clean, won't refresh resources

I upgraded to Ubuntu 11.10, Eclipse 3.7.0, ADT 14.0.0.

When I replaced a picture resource in the /res/drawable-nodpi directory on the desktop, or a sound resource in the /res/raw directory, both the recompiled program and the Project Explorer use some previously cached version.

I tried the following, none of which worked:

right-click on filename in project explorer:  Refresh
right-click on /drawable-nodpi dir in p.e.:   Refresh
right-click on /res dir in p.e.:              Refresh
right-click on Project in p.e.:               Refresh
Project -> Clean...
Project ->  check Build Automatically,  Run->Run

The program recompiles new source code changes correctly, but reuses its own cached resources. This is with an existing project that used to work under Ubuntu 10.

As a workaround, I renamed the file on disk; Deleted the file in the Eclipse Project Explorer; restored the name of the file on disk; and then dragged the file from the desktop into the /res/drawable-nodpi folder in the Project Explorer. Eclipse came back with a popup asking whether I wanted to Copy or Link the file into Eclipse. I chose Link. This finally got the new version of the resources imported.

Update: After the source code that used these images got modified elsewhere, it quit recompiling, saying R.drawable.mypicname no longer referred to anything. So the Linked resources don't appear to be reliable after all. The latest workaround is to manually Copy the file on the desktop and Paste it into the Eclipse ProjEx /res/drawable-nodpi directory. This recompiled without any source code change, and ran on the device.

Both Clean and Refresh not working correctly is quite unexpected behavior. Why is it doing this? What am I doing wrong? How can I set the Eclipse environment so that when I change the file on disk, it uses the current latest version? Or at least allows me to Refresh? Thanks.

like image 709
DragonLord Avatar asked Nov 09 '11 20:11

DragonLord


1 Answers

Enable lightweight "refresh on access" to keep the workspace synchronized with the filesystem.

This option in Eclipse is in Preferences under General->Workspace as shown here.

like image 138
almalkawi Avatar answered Nov 10 '22 00:11

almalkawi