Im using the latest version of Android Studio and it won't allow me to add and external SD Card made with "mksdcard". In previous versions this was possible but now it just reverts to blank every time I try to add a new SD card.
Anyone face this problem or know how to fix?
One of the issues that the Android forgot to mention is with Android Studio 3.0 when you create AVD you need to now create an image for the SD CARD with the
mksdcard tool to create a FAT32 disk image. After you use this tool then when you are creating the AVD you will see under advanced view the SD CARD area the
External files click that and navigate to where you stored the sdCard.img file you created with mksdcard tool.
Here is a bonus trick USE WITH CAUTION you can tell that emulator that it has the SD CARD ejected by changing this value hw.sdCard=yes in its config.ini file from
yes to no. How to find the config.ini file
Windows Explore find the android/avd/device name open the device name file then
with a FILE EDITOR like Sublime Text make the change to hw.sdCard=no and do a
SAVE AS I suggest you not use MS notepad to do this
I was facing the same problem today and found your question here on SO.
I was able to solve this issue by finding the config.ini file of the AVD itself,
and by editing it manually (e.g. with Notepad). On my Windows 10 machine the file is this one.
C:\Users\peter\.android\avd\Nexus_5_API_25.avd\config.ini
In that file I had to manually edit the value of this property as follows.
sdcard.path=C:\Programs\Android\SD_Card_Image\SD_Card001.img
That seems to make Android Studio to not revert back to a blank external file name.
EDIT:
The weird thing is that even you specify an external file for your SD card image (as opposed to a studio managed SD card), that doesn't mean the AVD is using this exact file which you specified. Seems it uses it just initially (for initialization). Then Android Studio creates a copy of the image file somewhere (inside the AVD folder it seems) and from there on it uses his own copy. That was quite a surprising behavior to me. I even find it buggy. If that's what's intended, then what is the purpose of having the option to specify an external file?
That page does the same to me for "Device Frame" checkbox. It's always unchecked even though it does apply the skin.
So check first whether you can access the SD as you're supposed to.
Related
The VS emulator does not seems to be showing the SD card in the storage menu or through code. any idea how to get it working. even if we go through the SD card menu on the emulator options and provide a folder it doesn't seems to be working.
I first had to 'Pull from SD Card' which seemed to create the required hierarchy under the folder I identified. Then I did a 'Push to SD Card'. Still didn't behave entirely as I expected since no external storage was listed under settings. I just was trying to copy files across and this allowed me to do that.
I have been using genymoton for quite some time now.
Could someone pls. tell me if there is a way by which I can access the files present in the sd card of genymotion emulator?
Currently I have to upload them to google driver and then download on windows.
You can use shared folder for that. It is well explain on this Google+ post.
Here is the brief:
Go to your VirtualBox VM setting / Shared folder tab
Add a shared folder with the folder you want to shared, and check the "auto mount" option
Start your VM as usual from the Genymotion software
Your shared folder is available in the /mnt/shared directory (multiple shared folders are supported)
This is also possible using the Android Device Monitor.
You already have this if you have the Android SDK installed.
This method works for all connected devices, including emulators like genymotion.
In Android Studio, click the icon that says Android Device Monitor in the toolbar.
(This is also available from Eclipse or you can just type monitor in the command line after moving to the tools folder of your installed sdk)
In the Android Device Monitor, go to the File Explorer tab.
Make sure you have a device selected on the left side.
Find the desired file and select it.
For the sdCard you might need to open the storage folder and open the sdcard there.
Click the button on top that says "Pull a file from the device".
Make sure you select Pull, not Push. Unless if you want to put new files on your device ofcourse.
Save the file to your computer...
and voila! The file from your genymotion is now among your other files on your computer. Ready to be used however you like.
Or alternatively you can also use a third party app like airdroid or any advanced file explorer to exchange files between your device and your computer.
(For installing third party apps you either need to find the apk or flash gapps on your genymotion first and go to the play store.)
Another way that I adopted, just install EsFileEx on genymotion.
Grab your files that you want to copy from e.g
/sdcard/WhatsApp/media/dp.jpeg
Swipe to LAN, here you can see your local machine as 10.0.3.2 or any IP. Here you can access your shared folder/drive of local machine/PC, past copied file here and you done!
NOTE! R/W permission should be set on shared folder/drive of local machine/PC
You can use the eclipse with the ADT plugin and browse the file system like any other android virtual emulators. I have been using this for a while, but eclipse crashes at some times.
I have created an app which lets the user save an image to the sd card, but I cannot see it in the gallery app on my emulator. I'm not sure if I need special code for this or what but I need to be able to find it so that I can see if my code actually works.
I need to be able to find it so that I can see if my code actually works.
If your ultimate objective is to see the files on the SD card, then that can be achieved in several ways:
Use file explorer that comes bundled in Android Debug Monitor.***
Login to device/emulator shell, adb shell, and navigate to SD card folder (that's usually at /sdcard or /mnt/sdcard) and use ls command to list the contents.
Install/use one of many available file explorer apps and navigate to SD card through the device/emulator UI.
***Example:
Launch the ADM by running monitor command (if the SDK tools is not in your path, then first navigate to tools/ directory).
There will be several perspectives: LogCat, Threads, Heap, etc. You need to switch to File Explorer tab.
Above is File Explorer view for Galaxy Nexus, the actual path for SD card may differ for your device/emulator.
You need to add the File to the media Library look at the MediaScannerConnection. You will need to call the ScanFile (after connected) and then the image will be added to the gallery.
How do we get a current wallpaper absolute path
On Android 4.2 the wallpaper is located at:
/data/system/users/0/wallpaper
Replace the 0 with your user id (take a look in /data/system/users).
Make sure you are looking in the phone's root directory to start, NOT on the SDcard. Once you get to the right subdirectory the wallpaper file will just be called "wallpaper" and until you copy it to the SDcard and rename it to "YourName.jpg" the picture viewers may not recognize it as an image file.
I tried both ES File Explorer and Root Explorer (download from Marketplace) to copy the file from the phone root area., i.e. phone ROOT/data/data/com.android.settings/files/wallpaper...it's the lowest level of the phone storage itself, similar to "computer" in windows.
Probably the File Explorer on your phone won't let you access the root (your phone shouldn't need ROOT privileges just to copy the file)
use wallpaperManager and call getWallpaperInfo. This will return you a wallpaperinfo object which contains all the info about the wallpaper. Read more about the wallpapernfo here.
I would imagine that the current wallpaper will be stored in a private system folder.
On Android Oreo and using one of the provided wallpapers from the system, the wallpaper I wanted wasn't on the path mentioned by the accepted answer but I found the apk that had it on a system folder.
I got it from the path: system/framework/framework-res.apk
I had to open the apk and extract: /res/drawable-nodpi-v4/default_wallpaper.png.
Android Oreo is not in the place from other comments
Internal Storage/Android/data/com.android.systemui/files/backupwallpapers
I just had to find a wallpaper that I deleted from my downloads folder.
Download the apk file ...
go to this path...you can find it here
Download\com.amber.launcher.skin.samsung.galaxy_2018-08-24\res\drawable-nodpi-v4\bg_wallpaper.jpg
Using the emulator, with external storage attached, I would like to emulate what happens when the application starts up and certain files are already present in the relevant directory on ext storage.
Is the external storage actually located on my machine, after enabling it in the AVD? Or should I be creating the files with some temporary, throw away code? Or should I just test on a real device?
What is best practice for this scenario?
The sdcard.img is in the avd folder (~/.android/avd). If you are using Linux or OSX you can mount it, manipulate the files inside, and unmount it.
Probably there's a program in Windows that let you do the same.
As an alternative, you can start the emulator and then manipulate the sdcard content using adb push/pull or DDMS.
The easiest way of creating the SDCard contents, would be to create the files that you need on your machine and then using the DDMS Perspective in Eclipse you can select your emulator in the Devices panel on the left, and then choose the FileExplorer tab on the right. There is a folder named sdcard which contains the SDCard contents.
By using the controlls on the right upper-side you can create folders inside the SDCard and by you can also Push files on the emulators SDCard.
As #dtmilano said, you can also achieve the same thing using Command Prompt.