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

AndroidImageImportAndroid Studio

Android Problem Overview


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.

Android Solutions


Solution 1 - Android

  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 - Android

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 - Android

  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 - Android

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 - Android

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.

Solution 6 - Android

To import files from OS X Finder into Android Studio, just drag the relevant files to your resource folder.

  • Drag & Drop by default moves files to your project (not what you always want)
  • Pressing ⎇ (Alt) while dragging copies files

Don't find a permanent config option for this, but this is the workaround I'm using

Solution 7 - Android

For Android Studio:

Right click on res, new Image Asset

Select the image radio button in 3rd option i.e Asset Type

Select the path of the image and click next and then finish

All the images are added to the respective folder, its very simple

Solution 8 - Android

You can simply use the terminal that comes with Android Studio. It is listed at the bottom of Android Studio. Just open it and use the cp command.

Solution 9 - Android

I'm in Mac OSX as well and in a new project I need to:

  • Right click on res folder in the project and add a new Android resource directory.
  • Select drawable from the drop down and Accept.
  • Copy and paste the image into the drawable folder.

Disclaimer : This does NOT cover different resolutions etc.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionwebschneckeView Question on Stackoverflow
Solution 1 - AndroidMichael A.View Answer on Stackoverflow
Solution 2 - AndroidKishan VaghelaView Answer on Stackoverflow
Solution 3 - Androiduser3314574View Answer on Stackoverflow
Solution 4 - AndroidChris KlinglerView Answer on Stackoverflow
Solution 5 - Androidbigtex777View Answer on Stackoverflow
Solution 6 - AndroidDiego FrenicheView Answer on Stackoverflow
Solution 7 - AndroidPatrickView Answer on Stackoverflow
Solution 8 - AndroidshivtejView Answer on Stackoverflow
Solution 9 - AndroidAMAN77View Answer on Stackoverflow