Reputation: 271
I put an image in my res/drawable folder, but when I clean and build my project, I receive the error message R cannot be resolved
. I don't understand why this happens, what should I do?
Upvotes: 1
Views: 5087
Reputation: 6321
For Android Studio:
The image will be saved in the /res/drawable folder!
Upvotes: 0
Reputation: 3288
Might be you are using android.R.drawable.your_image
Remove android.R from imports. use R.drawable.your_image
Upvotes: 0
Reputation: 3822
Check out the following link: http://source.android.com/source/using-eclipse.html
Note: Eclipse sometimes likes to add an "import android.R" statement at the top of your files that use resources, especially when you ask eclipse to sort or otherwise manage imports. This will cause your make to break. Look out for these erroneous import statements and delete them.
After removing the erroneous imports, delete your R.java file and try to clean and build the project again. If the problem still persists, post here.
Upvotes: 3
Reputation: 116030
possible causes:
duplicate file names (across all drawables folders) . for example , is there a file named "h1.png" and also "h1.jpg" ?
bad files names . only letters allowed are lowercase english ones , and digits.
hidden files , like those of the OS . on windows , it's probably "Thumb.db" . either delete them , or delete & disable them. linux and mac also have such files , but with different names and usually start with "." .
Upvotes: 1
Reputation: 132992
Make sure your image name is in small latters and in res/drawable folder.for how we add drawables in our project and supported images formats see docs Drawable Resources
Upvotes: 0