I needed some pictures in the gallery of a virtual device, because i was browsing the gallery in an android application to select a picture and show it in the application.

This was written for the mac and in test with Xamarin Android Player and Xamarin but the idea is the same on windows :

1) make sure you installed Android SDK Platform-tools trough Android SDK Manager(in case of Xamarin it’s located at TOOLS-> Open Android SDK Manager

2) In case of Xamarin on Mac, the default location of android sdks manager is /Users/administrator/Library/Developer/Xamarin/android-sdk-macosx (username on pc is “administrator” so that will differ)

3) Open an Android Virtual device (with whatever you want eclipse/android studio/geny motion/xamarin android player) .

4) Open terminal or cmd

5) you need to go where the adb.sh (in case of mac) or adb.cmd(in case of windows) is located.

6) in my case i typed cd ~/Users/administrator/Library/Developer/Xamarin/android-sdk-macosx/platform-tools

7) you can type ls (in mac) or dir(in windows) to display a list of files in the location you arrived to be sure adb.sh (in mac) or db.bat (in windows) is there

8) type ./adb devices (mac) or adb devices (windows) (the rule is type “./adb” for mac or “adb”) 9) if the virtual device is on, you should see something like List of devices attached device

10) ./adb connect or adb connect (don’t type the port, it will look for 5555 by default)

11) ./adb push ~/Desktop/pic2.jpg /sdcard/Pictures (you upload files to the device with the push command) Don’t try to upload to the internal storage because you will get “Read-only file system”

12) next you need to trigger a media scan on the device, or the files won’t be seen until you reboot the device(in case of avds), on the device taking a picture or modifying file structure will trigger an update

./adb shell am broadcast -a android.intent.action.MEDIA_MOUNTED -d file:///mnt/sdcard

You should see the files in the gallery now, and you can use them in any applications that use the camera roll, or you need to select a picture from the gallery etc.