How to import or copy images to the "res" folder in Android Studio?
Solution 1
Go to your image in windows, then press ctrl + c OR Right click and Copy
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:
- In Android Studio, open an Android app project.
- In the Project window, select the Android view.
- Right-click the res folder and select New > Vector Asset.
Solution 3
- go to your image in windows and copy it
- go to the res folder and select one of the drawable folders and paste the image in there
- click on imageview then go to properties and scroll down until you see src
- 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.
Related videos on Youtube
webschnecke
Updated on July 05, 2022Comments
-
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 fromAndroid Studio
?If I drag an drop my images from the
Finder
(MacOS), the files only move to theres
folder.At in the
context-menu
there is noImport...
and underNew...
there is also not.-
etienne almost 11 yearsDrag-and-drop to the relevant directory works fine.
-
webschnecke almost 11 yearsAS= Android-Studio :-) , but drag & drop just move in MacOS not copy :-(
-
Priebe almost 11 yearsWhy not use copy-paste shortcuts? Using Cmd+C in Finder and in AS Cmd+V for the file you want to import
-
Kishan Vaghela about 9 yearsFor android studio, Use this plugin github.com/winterDroid/…
-
TaraGurung about 9 yearsCopy paste works absolutely fine in my case , i was not able to drag and drop the image file so I copy pasted. Works
-
Saneesh over 6 yearsUse this link to get an idea . youtube.com/watch?v=Dvf_wjQPl48
-
Ignacio Ara about 6 yearsCopy 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 over 5 yearsI 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 about 9 yearsDoes 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 over 8 yearsWorks for OS X this way as well - while dragging shows a drop-spot, but does nothing on button release.
-
Christopher Bonitz about 8 yearsThe Scaled drawable does not exist in the version I just installed, has this changed?
-
Christopher Bonitz about 8 yearsThe bulk load method can scale pictures, just bulk load a single drawable.
-
Basheer AL-MOMANI about 8 yearshow is this please explain
-
shivtej about 8 yearsClick on Terminal written on the bottom of Android Studio and then use it like normal linux terminal. You can use
cp
ascp path/to/image yourproject/app/src/main/res/
. Not sure about other operating systems but this works in linux.