How to import or copy images to the "res" folder in Android Studio?

197,276

Solution 1

  1. Go to your image in windows, then press ctrl + c OR Right click and Copy

  2. Go to Your res Folder And choose One of the folders(eg. MDPI, HDPI..) and press ctrl + v OR right click it and Paste

Solution 2

Goto Settings > Plugin > Browse Repository > Serach Android Drawable Import

This plugin consists of 4 main features.

  • AndroidIcons Drawable Import
  • Material Icons Drawable Import
  • Scaled Drawable
  • Multisource-Drawable

Edit : After Android Studios 1.5 android support Vector Asset Studio.


Follow this, which says:

To start Vector Asset Studio:

  1. In Android Studio, open an Android app project.
  2. In the Project window, select the Android view.
  3. Right-click the res folder and select New > Vector Asset.

enter image description here

Solution 3

  1. go to your image in windows and copy it
  2. go to the res folder and select one of the drawable folders and paste the image in there
  3. click on imageview then go to properties and scroll down until you see src
  4. insert this into src @drawable/imagename

Solution 4

If you want to do this easily from within Android Studio then on the left side, right above your file directory you will see a dropdown with options on how to view your files like:

Project, Android, and Packages, plus a list of Scopes.

If you are on Android it makes it hard to see when you add new folders or assets to your project - BUT if you change the dropdown to PROJECT then the file directory will match the file system on your computer, then go to:

app > src > main > res

From here you can find the conventional Eclipse type files like drawable/drawable-hdpi/drawable-mdpi and so on where you can easily drag and drop files into or import into and instantly see them. As soon as you see your files here they will be available when going to assign image src's and so on.

Good luck Android Warriors in a strange new world!

Solution 5

For Mac + Android Studio 2.1, I found the best way is to save the image and then copy (cmd + c) the image file in Finder and then click on the the drawable directory and cmd + v to paste in that directory. Copying the image directly from a website using cmd + c (or right click then copy) doesn't seem to work.

Share:
197,276

Related videos on Youtube

webschnecke
Author by

webschnecke

Updated on July 05, 2022

Comments

  • webschnecke
    webschnecke almost 2 years

    I can save all my images directly in the res/drawable-xxx folder.

    But how can I import/copy images to my project from Android Studio?

    If I drag an drop my images from the Finder (MacOS), the files only move to the res folder.

    At in the context-menu there is no Import... and under New... there is also not.

    • etienne
      etienne almost 11 years
      Drag-and-drop to the relevant directory works fine.
    • webschnecke
      webschnecke almost 11 years
      AS= Android-Studio :-) , but drag & drop just move in MacOS not copy :-(
    • Priebe
      Priebe almost 11 years
      Why not use copy-paste shortcuts? Using Cmd+C in Finder and in AS Cmd+V for the file you want to import
    • Kishan Vaghela
      Kishan Vaghela about 9 years
      For android studio, Use this plugin github.com/winterDroid/…
    • TaraGurung
      TaraGurung about 9 years
      Copy paste works absolutely fine in my case , i was not able to drag and drop the image file so I copy pasted. Works
    • Saneesh
      Saneesh over 6 years
      Use this link to get an idea . youtube.com/watch?v=Dvf_wjQPl48
    • Ignacio Ara
      Ignacio Ara about 6 years
      Copy file in windows and secondary/paste works like a charm (Using Android Studio 3.X.X). It just adds *.png and in addition creates the XML dependencies needed
    • Dũng Trần Trung
      Dũng Trần Trung over 5 years
      I made a tool here so you can select the images with the highest resolution and it will resize and copy to all your drawable folders: github.com/datmt/Copy-And-Resize-Drawable-Images-X-DPI
  • Antonio Sesto
    Antonio Sesto about 9 years
    Does it make any difference which folder I select? I am struggling to find any documentation about the "New Image asset" command. The first question concerns the 'destination directory'... What a mess they did.
  • brainray
    brainray over 8 years
    Works for OS X this way as well - while dragging shows a drop-spot, but does nothing on button release.
  • Christopher Bonitz
    Christopher Bonitz about 8 years
    The Scaled drawable does not exist in the version I just installed, has this changed?
  • Christopher Bonitz
    Christopher Bonitz about 8 years
    The bulk load method can scale pictures, just bulk load a single drawable.
  • Basheer AL-MOMANI
    Basheer AL-MOMANI about 8 years
    how is this please explain
  • shivtej
    shivtej about 8 years
    Click on Terminal written on the bottom of Android Studio and then use it like normal linux terminal. You can use cp as cp path/to/image yourproject/app/src/main/res/. Not sure about other operating systems but this works in linux.