121

I am developing an image filter app. But can't really try it if i don't have any images.

I know that i can test it in the phone, but it's not the same, since I need the error messages and other stuff.

I just want to access an image from the AVD's gallery so that I can test my app. How can I add one?

I am using Android Studio. I saw some examples on how to do it in Eclipse, but i am not using that.

So, how can I add an image to the emulator image gallery?

Himani Trivedi
  • 158
  • 2
  • 3
  • 16
user3013172
  • 1,637
  • 3
  • 15
  • 26
  • 4
    Have you tried using the web browser and saving it? – Cristik Apr 12 '15 at 09:55
  • Copy it to the DCIM folder in your emulator? – Phantômaxx Apr 12 '15 at 09:55
  • 1
    `but it's not the same, i need the error messages and other stuff.`. What do you mean? You get all logs and exceptions and stacktraces and errors in your logcat if you use a real device connected with a usb cable to your development pc. – greenapps Apr 12 '15 at 10:01
  • You might want to read [How do I ask a good question](http://stackoverflow.com/help/how-to-ask), which enhances the probability for getting a useful answer _drastically_. You might find [ESR](https://en.m.wikipedia.org/wiki/Eric_S._Raymond)'s excellent essay [How To Ask Questions The Smart Way](http://catb.org/~esr/faqs/smart-questions.html) helpful, too. – Markus W Mahlberg Apr 12 '15 at 14:48
  • If your path for android sdk is set , then you can simply use `adb push` command from command prompt. e.g if you have image say wallpaper.jpg in D: drive the open command prompt, `cd ` to D drive then , `adb push wallpaper.jpg /sdcard/` .. make sure your emulator is on – Ichigo Kurosaki Dec 15 '17 at 09:17
  • How about using your emulator's browser to download random images? – Yash Joshi May 15 '21 at 18:55

15 Answers15

153

It's a very old question but I will answer this for future references.

To add any file to emulator just drag and drop the file.

The file will be copied to downloads folder of internal storage.

To access the file

Go to settings

Click On Storage & USB

Click On Internal Storage

Click On Explore (at the end)

and you got it in the downloads folder

now you will get notification to setup virtual SD card, follow the setup. after the successful setup you will be able to see pictures in gallery.

Forge
  • 6,538
  • 6
  • 44
  • 64
Mithilesh Izardar
  • 2,117
  • 1
  • 13
  • 24
  • 10
    Yes, this works, and _far_ more simply than the other answers present here. `Drag + drop` is the answer. No mucking around with device monitors, settings, tools apps, or mounted filesystems. Just launch the virtual device, drag, and drop. – aroth May 30 '17 at 01:58
  • 3
    But nothings loads in gallery. when oi check from DeviceExplorer i can find the file in path but from emulator nothing shown. – Mahdi Nov 21 '18 at 09:25
  • If I could have up-voted this solution more than once I would have! This was such a simple solution and I was surprisingly unable to find it anywhere else online. – Part_Time_Nerd Apr 03 '20 at 14:47
  • 4
    I don't see `Explore` option in my emulator – Harsha Jun 07 '21 at 18:32
  • And this is why I use iPhone – Dazzle Apr 08 '22 at 16:38
  • I think this answer is now outdated – Dror Bar Nov 08 '22 at 10:30
  • I don't see Storage & USB, I only see Storage and there's no Internal Storage in there. – Can Poyrazoğlu Aug 16 '23 at 12:47
61

I'd like to complement Mithilesh Izardar's answer:

Indeed the best approach is simply to "Drag and Drop", which afterwards you can find the files in the emulator at Settings → Storage → Internal Storage → Explore → Download (API 25). The problem for me was that after following these steps the pics weren't appearing neither in the "Gallery" nor in the "Downloads" (by simply clicking the "Downloads" icon).

The reason for this is because by default everything in the emulator has no permissions...so all you gotta do is give the "Gallery" storage permission: Settings → Apps → Gallery → Permissions (API 25)

Ps: If you just copied the pictures, the new ones won't show up right away. You should either restart the emulator, or remount the sdcard (at Settings → Storage unmount the sdcard by clicking the eject icon then remount it)

F. ALA
  • 913
  • 8
  • 10
44

How to import images into the gallery of an Android Virtual Device using Android Studio: I'm using Android Studio 1.4.1 and a API 15 virtual device.

Warning: This is manual intensive so it is not a good solution for a large number of images.

  1. Create a virtual device using Android's Device Manager (AVD), Menu /Tools/Android/AVD Manager.
  2. Start this virtual device.
  3. Start the Android Device monitor, Menu */Tools/Android/Android Device Monitor. In the Devices tab (upper left) you should see your device. It should be Online (see this screenshot)
  4. On the right window is the File Explorer. Go there and select the /mnt/sdcard/Pictures directory. It should be highlighted (see this screenshot)
  5. Add jpegs to this directory by clicking on the Push a file onto the device icon (the little phone icon I highlighted in the above screenshot. You can add only one photo at a time, dadburnit.
  6. Go to your device and run the Dev Tools app.
  7. Scroll down and select Media Provider.
  8. Click on the Scan SD Card button. This should copy the images you added in step 5 to the gallery. Go to the gallery and look, they should be there.
ssimm
  • 1,908
  • 3
  • 16
  • 36
21

After trying to add an image via the Device Monitor or via drop, I could find it when exploring, but it was still not shown in the Gallery.

For me, it helped to eject the (virtual) sdcard from Settings > Storage & USB and reinserting it.

H. de Jonge
  • 878
  • 7
  • 25
18

I went through the Android Device Monitor

  1. Click on device
  2. Select Android Device Monitor's File Explorer tab
  3. Select Pictures folder (path: data -> media -> 0 -> Pictures)
  4. Click "Push folders on to device" icon
  5. Select pic from computer and ok.
Boo
  • 419
  • 6
  • 13
15

As of API 28 at least:

  1. Open Settings app in emulator
  2. Search for "Storage" select search result for it
  3. Select Photos & Videos in Storage
  4. Select Images
  5. Drag an image onto the emulator, it won't immediately show up
  6. From the AVD Manager in Android Studio, cold boot the emulator

The photos you've dragged in are now available.

Philip
  • 655
  • 8
  • 12
14

Copy a file to the emulator:

Open emulator and File Explorer (Finder in Mac) side by side. Choose the file you want to copy then Drag and Drop the file onto the emulator. The selected file will be copied to the Downloads folder of the emulator.

How to view files in Android Studio:

Android Studio has Device Explorer to explore emulator content (Earlier we used to have DDMS, which is deprecated in Studio 3+). Goto View -> Tools Window -> Device File Explorer and you can see the explorer window. Goto Storage -> emulated -> 0 ->Download, if you don't see the file here, please restart the emulator and that's it.

Note: You don't see Device Explorer if you have opened a Flutter project.

You can also view the image files in Android Studio by double-clicking the file in the emulator.

See image below

RamKr
  • 756
  • 10
  • 17
8

Workaround simple and quick. Upload file/photo on cloud (from outside the emulator) and download with browser on the emulator.

Darius
  • 127
  • 1
  • 2
6

Try using Device File Explorer:

  1. Start the Device

  2. Navigate to View->Tool Windows->Device File Explorer to open the Device File Explorer

  3. Click on sdcard and select the folder in which you want to save the file to.

  4. Right-click on the folder and select upload to select the file from your computer.

  5. Select the file and click ok to upload

afhamu
  • 930
  • 11
  • 17
5

I had the same problem too. I used this code:

Intent photoPickerIntent = new Intent(Intent.ACTION_GET_CONTENT);
photoPickerIntent.setType("image/*");
startActivityForResult(photoPickerIntent, SELECT_PHOTO);

Using the ADM, add the images on the sdcard or anywhere.

And when you are in your vm and the selection screen shows up, browse using the top left dropdown seen in the image below.

look at 'open from'

Forge
  • 6,538
  • 6
  • 44
  • 64
Shaare
  • 81
  • 1
  • 6
3

Although you can have logat on a real device too, if you need to use an emulator try transferring the images through the Android Device Monitor, accessible from the toolbar in Android Studio (it's in eclipse too, of course).

Once you select the device from ADM, you can see the folders tree and copy things inside

basteez
  • 477
  • 1
  • 5
  • 15
2
  1. open emulator and image folder of your pc windows side by side. Drag and drop images to emulator.

  2. download the images from web on your emulator.

Happy Coding :)

Sangeeth
  • 71
  • 4
1

How to add images into emulator ?

Method-1:

  1. Drag and Drop images into emulator
  2. Emulator > Settings > Storage > SDCARD > unmount then re-mount
  3. Open Download app to see the images or from gallery access storage images.
0

Others have already answered the question, this is to show how you can do it in the real device. Of course, you have to use the emulator if you have some reasons against using your real device.

Logs and exceptions will be displayed in the 'Run' tab in Android Studio. I have worked on apps which have C++ and Java.

C++ logging:

__android_log_print (ANDROID_LOG_VERBOSE, "Logger", "C++-JNI");

Java logging:

Log.i("Logger", "Java");

These kind of logs show in the 'Run' tab and this should cover all your needs.

Follow the steps here to to set up your device for debugging.

NightFuryLxD
  • 847
  • 5
  • 15
0

some how drag and drop doesn't work for me, but this worked.

go to Device explorer, right bottom , vertical tab generally. in directory tree choose mnt\sdcard<destination Directory>, right click on it, select "Upload", then select desired files you want to upload. Device File explorer