Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.