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 trialRalfs Ceksters
6,298 PointsFailed to convert @drawable/main_title into a drawable No other answer works.
I put the drawable folders beside the drawable folder not into it. When i try to use the src property for ImageView widget, i get the following error:
Rendering Problems Couldn`t resolve resource @drawable/main_title Failed to convert @drawable/main_title into a drawable
3 Answers
Christopher Augg
21,223 PointsHello Ralfs,
Just to be clear. You download and placed the following drawable folders that have the image files into the Res folder?
- drawable-hdpi
- drawable-mdpi
- drawable-xhdpi
- drawable-xxhdpi
This should be ok using 1.3.1. Just know that the ic_launcher.png file that comes with the download should be moved out of each drawable folder and into the following folders that are in the Res folder as well:
- mipmap-hdpi
- mipmap-mdpi
- mipmap-xhdpi
- mipmap-xxhdpi
You removed the ._ in front of every image file that has it? For exmple: main_title.png is now title.png and ic_launcher.png is now launcher.png ?
I would recommend keeping the names of the image files as we should use a naming convention for our image files that best represents the activity they will be used. Since activity_main is the one we are using main_title.png, it is more clear to have it named accordingly. However, it is definitely alright to rename it to title.png. We just have to make that change in Android Studio as well though.
Supposing that is the case, have you tried to use:
android:src="@drawable/title" in your activity_main.xml or enter in just @drawable/title into src under properties in design view? That should point to your newly named image file if it is within the folders as described above. You should also be able to click on the ... button next to src under properties and scroll through the list until you see the image file you want.
Of course, if you cannot open an image file with Preview on OSX or some other image viewing software, then you should delete those image files and re-download.
Please let me know if I am understanding your issue correctly and if this information helps. I can help further with more information.
Regards,
Chris
Ralfs Ceksters
6,298 PointsJust opened android studio and the problem has resolved itself somehow. ;D Weird, i tried to get that image working 2hours yesterday. Thanks for the answer, i hope it will help other people. :)
John Keith Zank
11,848 PointsSame thing happened to me as well. I'd recommend anyone else with this issue just simply close the Android Studios completely then relaunch it.
Ralfs Ceksters
6,298 PointsI am using Android Studio 1.3.1 if it helps.
limlim
1,366 Pointslimlim
1,366 PointsMy situation was I had initially put all files (icons and other images) in the mipmap folders, then I read this: http://android-developers.blogspot.co.uk/2014/10/getting-your-apps-ready-for-nexus-6-and.html and moved moved the other images to the drawable folders in res but left IC_launchers in the mipmap.
on updating the xmls that's when I got the error.
An Android Studio restart fixed it for me too.