5

I'm brand new to Android Studio and fairly new to development, so I might be missing something simple.

I am trying to import the ic_action_search.png from the Action Bar Icon pack. I've downloaded the Action bar Icon pack, selected the 4 directories containing the images (drawable-hdpi, drawable-mdpi, etc) and copied and pasted them into Android studio.

But in my menue_my.xml file I get a

Cannot resolve symbol error

at the line android:icon="@drawable/ic_action_search"

Here is a screenshot of my android studio with the xml file

enter image description here

I added the png's in project mode, and have tried build>clean and build>rebuild with no success.

When viewing the file structure in "Project" or "Packages" the drawable files appear to be there but not when the file structure is viewed from "Android". Also I don't seem to be able to paste the drawable files into the res folder while in viewing the file structure in "Android".

TMin
  • 2,280
  • 1
  • 25
  • 34
  • Meta Delema, Now that I've answered my question I realise that it is similar to this question http://stackoverflow.com/q/29294287/2779461, but I didn't find this question orriginally because I dealing with the symptom caused by the problem with my file structure (the "cannot resolve symbol error). Should I delete my question because it's a duplicate, or should I keep it up incase other people come accross this symptom and don't know to look at the other question? – TMin Mar 28 '15 at 13:14

1 Answers1

9

So the problem seems to have been with my file structure I was using

res/drawable/drawable-hdpi
res/drawable/drawable-mdpi
res/drawable/drawable-xhdpi
res/drawable/drawable-xxhdpi

where I should have been using

res/drawable-hdpi
res/drawable-mdpi
res/drawable-xhdpi
res/drawable-xxhdpi

so that the drawable directories for the various resolutions are siblings to res/drawable, NOT children.

Thanks to this answer https://stackoverflow.com/a/29294374/2779461

Community
  • 1
  • 1
TMin
  • 2,280
  • 1
  • 25
  • 34