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 trialMUZ140190 Tinashe Chinyanga
7,406 PointsImages 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?
Antonis Tsagaris
17,511 PointsHave you tried cleaning your project?
MUZ140190 Tinashe Chinyanga
7,406 PointsR.drawable.page1 were page1 is the name of the image
2 Answers
MUZ140190 Tinashe Chinyanga
7,406 PointsFixed 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.
Alexander Teitelboym
7,761 PointsBe 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?
Alexander Teitelboym
7,761 Pointstry File -> Invalidate caches and restart.
MUZ140190 Tinashe Chinyanga
7,406 PointsThanks, however the issue is still persisting.
Jon Kussmann
Courses Plus Student 7,254 PointsJon Kussmann
Courses Plus Student 7,254 PointsCan you show how you are trying to reference the images?