Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Weather App (2015) Networking Building an HTTP Request

Images in drawable folder cannot be referenced

In the interactive story app, referencing the images using the R.drawable.image_name call is giving an error, cannot resolve image_name.

The drawable folder has all the necessary images and these are appearing as well when the image is double clicked.

How can this be rectified?

Jon Kussmann
Jon Kussmann
Courses Plus Student 7,254 Points

Can you show how you are trying to reference the images?

Antonis Tsagaris
Antonis Tsagaris
17,511 Points

Have you tried cleaning your project?

R.drawable.page1 were page1 is the name of the image

2 Answers

Fixed it guys, changed the location of the images. The images were in a folder, cut them from those folders and pasted them directly into the drawable folder.

Be careful with the drawable folder. as it may either make the images look bad on some devices or even not display them at all.

you should only use drawable-[ldpi|mdpi|hdpi|xhdpi|xxhdpi|xxxhdpi].

p.s. why am i getting a negative point for trying to help?

try File -> Invalidate caches and restart.

Thanks, however the issue is still persisting.