0

Am trying to add icons to a navigation drawer but somehow, I can't access resources in the res/drawable folder.

This is the list of icons I have in my drawable-hdpi folder:

enter image description here

But I can't access any of them using the correct method:

enter image description here

It says cannot resolve the symbol '@drawable/ic_action_user'

This is strange because I have another application open that uses the exact same method and it works fine there.I've tried invalidating cache and restarting Android Studio with no luck.

All I get are the icons in the drawable-v21 folder:

enter image description here

enter image description here

Ojonugwa Jude Ochalifu
  • 26,627
  • 26
  • 120
  • 132

6 Answers6

3

You have created drawable-hdpi folder inside drawable.
You should move it to res folder .

Jonas Czech
  • 12,018
  • 6
  • 44
  • 65
subrahmanyam boyapati
  • 2,836
  • 1
  • 18
  • 28
1

Try to use gradle task 'clean' and rebuild project

nick_kryloff
  • 126
  • 6
1

You need to put images in drawable folder instead of drawable-v21. Create below drawable folder under res .

drawable-ldpi

drawable-mdpi

drawable-hdpi

drawable-xhdpi

drawable-xxhdpi

Then Clean & Rebuild your Project . Hope this helps .

You can check #SO How to import set of icons into Android Studio project

Community
  • 1
  • 1
IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
0

First check that the icons is available in your resources folder.

S Sathiya
  • 47
  • 7
0

Try to put your images in the main drawable directory (res/drawable).. Not in the sub one (res/drawable-hdpi)

Ahmed Elgendy
  • 1,670
  • 2
  • 12
  • 17
0

you might have set min sdk version to 21 in gradle, set it to below version or copy all drawables in drawables-hdpi to drawables-v21, as only drawables in drawables-v21 will be used in versions equal to and above 21

Deepak John
  • 967
  • 1
  • 7
  • 19