Android: R.drawable not showing my image?

I had the same problem for a different reason. In my case I had illegal characters in the image file name and hadn't noticed the console message complaining about it.

Once I'd renamed icon-1.png to icon_1.png all was well.


You need to use a fully qualified name when importing the generated R file. Check your import statements.

Take the following package statement:

package me.rhys.example;

Then the generated R file can be imported using:

import me.rhys.example.R;

I figured this out. The issue was that the project was importing android.R instead of using the generated R file - if you encounter this problem, check your imports to make sure the correct package/file is being imported.