I have some custom drawable but unfortunately a drawable doesn’t load when I try to run the app on a device.
- I have tried to clean workspace… Same issue.
- I have tried to remove and re-import the project cleaning the .metadata folder… Same issue.
- I have tried to remove autogen file R.java… Nothing.
- I have tried to change the images used… Nothing.
- I have changed the name… Ops, this time the drawable with the problem start working BUT the same issue happens with another image.
With various test I have noticed that the not-loaded image is always the first in
public static final class drawable {...}
inside the autogenerated file R.java
In detail, the resource image with the address 0x7f020000:
public static final int bt_a_1=0x7f020000;
these addresses are assigned alphabetically
so I have solved simply adding another image named a1.png that is not used in the project.
With this workaround all works fine but I don’t know what is the cause of this absurd issue.
EDIT
This is an Android Issue fixed since HoneyComb release in change Ia971bb242ceac5e8f9346094009a10f356399ab9
The problem happens due to a low-level resource cache collision bug.
More info at:
https://android-review.googlesource.com/#/c/15815/
This problem can happens in all device with OS older than HoneyComb… to avoid the bug in these device, use same strategy that I have described.
That is a known issue, I guess it’s solved in Honeycomb.
http://code.google.com/p/android/issues/detail?id=20283