Android drawables are not recognized by AndroidStudio if I use dpi subfolders
Question: I have just started the [Treehouse](http://www.teamtreehouse.com) Android
development course, I have also asked this question on their forums without
any luck.

**DATA**

  * AndroidStudio v 1.2.2, the course is based on v0.86 I think
  * OS / DE: Manjaro Linux, KDE

I have copied the image files inside the drawable folder, each into their
specific dpi folder.

I have created the ImageView for a mail_title.png, and added the src as the
full path to the png. When I do that, the image loads into the preview screen,
and I can work with it, but If I try to build the app it just says the value
of src cannot be a string.

So then I tried to point to it as a resource. On many forums and the android
documentation I only found that I should reference it through a "pointer"
@drawable/main_title , when I downloaded the projectfiles from the course I
saw thats how they did it too.

If I try to rebuild now it gives the following error:

    
    
    Error:(14, 22) No resource found that matches the given name (at 'src' with value '@drawable/main_title').
    

Then I tried to create a resource inside strings.xml, I found some
autocomplete function that pointed me in "the right direction", of course it
did not work!, same error as before. I have tried using absolute paths as well
without luck.

Right now It shows R as "cannot resolve symbol R" in the MAinActivity file. I
figured out by reading online that this is due to my drawable not existing
problem.

Then I created a refs.xml in values and added

main_title.png I actually tried with and without the extension (png)

After that I clicked on the IDE suggestion to create a drawable folder and it
just created a @drawable folder inside of layout....

Basically it says it cannot resolve directory @drawable from activity_main.xml

and also

    
    
    Error:(3, 33) String types not allowed (at 'main_title' with value 'main_title.png'). on the refs.xml file (this happens whether I use the extension (png) or not.
    

The only solution I have found is to just copy one version fo the images to
the main drawables folder, and deleting all of the subfolders, if I don't
delte them then it also doesn't work...

So, as you can see I'm kinda lost... Any help would be appreciated. I'm a
python backend developer and I'm pretty comfortable usiong Pycharm (IntelliJ
for python), but somehow I feel Android Studio has me totally lost!


Answer: I use eclipse but i think its pretty much the same, you should have you
various drawable folders, then you have to include the R (res folder)

    
    
    import com.example.project.R;
    

and then call them by reference

    
    
    R.drawables.main_title
    

Note you dont need to specify which drawable folder , adroid does that for
you.

Also if you are getting unresolved errors with R then you may need to have the
appcompatv7 library inlcuded in your project.

