Can't add data to Android sdcard on the emulator - android

I can see the sd card in the file explorer with d--rwxr-x permission. When i tried adding any file to it it shows Failed to push the items. It is not adding even very small files.
Can you guys suggest how to fix this?

This is how you push files to the SD Card. First copy the file you want to push to the tools directory [android-sdk-windows]/tools/. Open a command prompt and if you don't have the tools directory in your path you will need to cd [drive]:\android-sdk-windows\tools. Then you just type this:
adb push [filename] /sdcard/[filename]
If you want to put the file into a subdirectory of sdcard you have to create it... you can do that in the adb shell or on the device with a file manager.

If you are working on Windows.
This site is very useful deltafalcon.com.

Related

How can i push files in sdcard - android

adb remount I get the following error device not found.
I am trying to create a folder and push multiple files on sdcard. When I try to use the command I have already created sdcard for my emulator.
I am using android with eclipse.
Anyone have a solution to this?
Here is the tutorial about push files on SD Card
http://www.coderzheaven.com/2011/03/24/how-to-add-files-like-images-inside-your-emulator-in-android/

Eclipse console shows:'Failed to push selection: Read-only file system'when i try to push a file

I am trying to push a file to the SD Card but its showing error in console 'failed to push selection: Read-only file system'.I am using DDMS perspective in Eclipse.I generated sdcard using mksdcard command.
Just go to
C:\Documents and Settings\<adminstrator>\.android\avd
take 'properties' of your avd folder (there is a folder for each of the avd's)
uncheck 'Read only' -> OK
This was the only thing that worked for me.
P.S: Some of these folders might be hidden.
On the Terminal or Command-Prompt, write these( for me its command prompt ):
adb shell(Opens the device shell. you'll see a #)
su(get the root permission, if necessary)
mount -o rw,remount rootfs /(remount the root file system.)
chmod 777 /mnt/sdcard (change the permission of the sdcard to rwe.)
exit
If it doesn't work, try to push the file from the same shell using adb push .
Hope this help.
You need to give SDCard support to your AVD and mount the SDCard.
First go to 'AVD Manager and select your AVD then Click on Edit and in the Hardware add SDCard Support'.
Please check this link for complete detailed step to achieve SDCard support and mounting.
You can also give a try to this command in CMD, this will remount your SDCard.
c:\android-sdk\platform-tools\>adb remount
I was also facing same issue :
Failed to push selection: Read-only file system
In computers with higher configuration(beyond Windows XP)
settings like ---> C:\Documents and Settings\.android\avd
doesn't exist so instead
go to this path --> C:\Users\.android and right click on this folder and uncheck the box having name as read only.
Hope this helps those with newer windows on their pc :) , if this solution helps you than please vote for it.
In my case i have mistake with the slash.
while specifying "Additional Emulator Command Line Options" in eclipse
Actually it should be -sdcard C:/Kamal/sdcard/emulator_sdcard
and i was putting -sdcard C:\Kamal\sdcard\emulator_sdcard
Then after restarting the Eclipse & Emulator it works.
If the data in the sd card is not updated in the emulator or in the app which you are developing then,
Select,
Dev Tools->Media Scanner
The data which has been already pushed into the sd card by variant means will get loaded soon.!
if some one have same problem in new build of studio . 0.8.9 and above see my solution here and it will work like a charm : (afra mehrparvar solution in the bottom of the page )
Android Emulator sdcard push error: Read-only file system

In AVD emulator how to see sdcard folder and install an APK to the AVD?

I have created an Android emulator (Android Virtual Device), but I am unable to find out the SD card I have built during creation of this.
How can I find the SD card and its content and also how to install APK files to the AVD?
switch to DDMS perspective
select the emulator in devices list, whose sdcard you want to explore.
open File Explorer tab on right hand side.
expand tree structure. mnt/sdcard/
refer to image below
To install apk manually:
copy your apk to to sdk/platform-tools folder and run following command in the same folder
adb install apklocation.apk
I have used the following procedure.
Procedure to install the apk files in Android Emulator(AVD):
Check your installed directory(ex: C:\Program Files (x86)\Android\android-sdk\platform-tools), whether it has the adb.exe or not). If not present in this folder, then download the attachment here, extract the zip files. You will get adb files, copy and paste those three files inside tools folder
Run AVD manager from C:\Program Files (x86)\Android\android-sdk and start the Android Emulator.
Copy and paste the apk file inside the C:\Program Files (x86)\Android\android-sdk\platform-tools
Go to Start -> Run -> cmd
Type cd “C:\Program Files (x86)\Android\android-sdk\platform-tools”
Type adb install example.apk
After getting success command
Go to Application icon in Android emulator, we can see the your
application
These days the location of the emulated SD card is at /storage/emulated/0
On linux sdcard image is located in:
~/.android/avd/<avd name>.avd/sdcard.img
You can mount it for example with (assuming /mnt/sdcard is existing directory):
sudo mount sdcard.img -o loop /mnt/sdcard
To install apk file use adb:
adb install your_app.apk
DDMS is deprecated in android 3.0. "Device file explorer"can be used to browse files.
Drag & Drop
To install apk in avd, just manually drag and drop the apk file in the opened emulated device
The same if you want to copy a file to the sd card
if you are using Eclipse. You should switch to DDMS perspective from top-right corner there after selecting your device you can see folder tree. to install apk manually you can use adb command
adb install apklocation.apk
I have used the following procedure.
Android Studio 3.4.1
View>Tool Windows>Device File Explorer
//in linux
// in your home folder .android hidden folder is there go to that there you can find the avd folder open that and check your avd name that you created open that and you can see the sdcard.img that is your sdcard file.
//To install apk in linux
$adb install ./yourfolder/myapkfile.apk
Adding to the usefile DDMS/File Explorer solution, for those that don't know, if you want to read a file you need to select the "Pull File from Device" button on the file viewer toolbar. Unfortunately you can't just drag out, or double click to read.

how to copy a file stored in /data/data/com.sai.myproj/files/a.txt to res folder in Android

I have a file stored in /data/data/com.sai.myproj/files/a.txt .This is the file I created and wrote data, it was stored in data/data/com.sai.myproj/files/a.txt which can be viewed using FileExplorer of DDMS. How to copy this file from there to res folder as I need to parse this file .
Can anyone help me in sorting out this issue.
Thanks in Advance,
You can use adb pull on your computer:
adb pull /data/data/com.sai.myproj/files/a.txt your-project-location/res
Adb is located in android-sdk/tools.
AFAIK an installed application cannot write to its own res folder
If you want to copy something from a device into the res folder of your project sources, you can use the adb tool, either from the command line by programmatic usage of the command line as part of a script or .bat file or using the shell exec function of your chosen language on your chosen development platform
Make sure you have the SDK fully installed and that the adb executable is in your path or reference it by its full path name (ie, make sure 'adb shell' works)

Not able to view SDCard folder in the FileExplorer of Android Eclipse

I am not able to view SDCard folder in FileExplorer of DDMS in Android.
But I was able to view SDCard folder when I used adb command from command prompt like below:
androidsdk\tools>adb shell
$ ls
I am able to view list of folders when I typed ls in which I can see sdcard folder from the list of folders .my doubt how can we view the sdCard option in Eclipse using FileExplorer.Also I want I want to delete or insert some files in sdcard.How can this be possible for me.can anyone hel me in sorting out this issue.
Thanks in advance.
I had the same problem:
Using Eclipse DDMS File Explorer the content of sdcard was not visible in any folder (CyanogenMod with Android 4.2.2).
The solution was:
On the device you have to give ADB root access. Here: Settings / Developer options / Root access
Then the content of sdcard is visible in this folder:
/mnt/shell/emulated/0
You can download Astro file explorer from marketplace to do this. It is free.
Try looking into /mnt/sdcard folder instead of /sdcard. I had the same problem.

Categories

Resources