Misca
Misca

Reputation: 469

Adding a drawable resource

:) I have my "drawable" folder inside "res" but when I try to add a new resource to it (rightClick -> new -> file -> browse for a jpg and png file) the autogenerated R doesn't see it (in Package Explorer R.java-> R -> drawable -> sees only the "icon"). I tried with Project -> Clean and with an xml bitmap declaration inside the drawable. What could it be?

Upvotes: 1

Views: 9773

Answers (7)

givanse
givanse

Reputation: 14943

Make sure you are importing the R class.

import com.example.prettyprojectname.R;

Upvotes: 0

recroot
recroot

Reputation: 21

If you have space in name of your application than sometimes resources are not visible. Try to remove space. Good luck.

Upvotes: 2

Uday
Uday

Reputation: 6023

Try restarting Eclipse, and refresh your current project.

Upvotes: 0

Michael George
Michael George

Reputation: 1

after you add a file .. You should recompile your Project to see your New Resource !

Upvotes: 0

olamotte
olamotte

Reputation: 917

what kind of error do you get ? cannot be resolved or is not a field ? this is kind of rude but I often delete the entire "gen" folder of my projects, to force regenerating the R.java

Upvotes: 0

tvkanters
tvkanters

Reputation: 3523

Are there perhaps errors in any other file in the resource folder? This could prevent R from being generated thus not showing your new drawables. (If there is an error, this will also show up in your console.)

Upvotes: 1

wojciechka
wojciechka

Reputation: 598

This happened to me a few times as well.

Try choosing Project -> Clean from menu and wait a while.

If this doesn't help, clean and eclipse restart might help.

Upvotes: 2

Related Questions