简体   繁体   English

如何在android中的模拟器上将文件导入sdcard?

[英]how to import files into the sdcard on emulator in android?

i want to load some photos into my sd card image in the emulator.我想在模拟器中将一些照片加载到我的 SD 卡图像中。 how to do this by command prompt.how to do that?如何通过命令提示符执行此操作。如何执行此操作?

I've found it to be incredibly clumsy and not work very well, but the command to use is: adb push yourfile.xxx /sdcard/yourfile.xxx .我发现它非常笨拙并且效果不佳,但使用的命令是: adb push yourfile.xxx /sdcard/yourfile.xxx For this to work you've got to have the file in the same directory as adb.exe, which is in the tools folder of your SDK directory, or have set up adb as a system-wide recognisable command.为此,您必须将该文件放在与 adb.exe 相同的目录中,该目录位于 SDK 目录的工具文件夹中,或者已将 adb 设置为系统范围内可识别的命令。 (I don't remember how to do that, but I know it can be done). (我不记得怎么做,但我知道可以做到)。 This also assumes you've set up an SD card through the AVD manager.这还假设您已经通过 AVD 管理器设置了 SD 卡。 However, the problem I faced when doing this is that sometimes the file would appear on the emulator with a size of 0 bytes.但是,我在执行此操作时遇到的问题是,有时文件会以 0 字节的大小出现在模拟器上。 What I mean is that I could see the file in the DDMS file browser in Eclipse, but after doing the necessary emulator restart, the files would then be shown with the 0 byte size.我的意思是我可以在 Eclipse 的 DDMS 文件浏览器中看到该文件,但是在执行必要的模拟器重启后,文件将显示为 0 字节大小。 I couldn't find a pattern on why that happened, but trying a few times in a row eventually worked.我找不到为什么会发生这种情况的模式,但连续尝试几次最终奏效。

On Android Studio在 Android Studio 上

  1. Run Emulator运行模拟器
  2. open android device monitor打开安卓设备监视器
  3. scroll down and select sdcard向下滚动并选择 SD 卡
  4. Click on Push file into sdcard icon at top right单击右上角的将文件推送到 sdcard 图标
  5. choose the file Hope this helps..选择文件希望这有帮助..

I've just found out how to add some files in the SD card image.我刚刚发现了如何在 SD 卡映像中添加一些文件。

  1. Turn all running emulators off but keep Eclipse on.关闭所有正在运行的模拟器,但保持 Eclipse 开启。
  2. Using thecommand line, start the ddms tool.使用命令行启动 ddms 工具。 ddms数据管理系统
  3. Now start stand-alone emulator console.现在启动独立模拟器控制台。 emulator -avd myAVDname -sdcard mysdcard.img模拟器 -avd myAVDname -sdcard mysdcard.img
  4. Push a file into the sdcard.将文件推入 SD 卡。 adb push yourfilename /sdcard/ adb push yourfilename /sdcard/
  5. You should get a message (how much memory it occupies)你应该得到一条消息(它占用了多少内存)
  6. In Eclipse, you will see the folders (including SD card and the files you just add) appear.在 Eclipse 中,您将看到文件夹(包括 SD 卡和您刚刚添加的文件)出现。

For me, the files didn't appear at the first time in File Explorer, then I closed the emulator and turned it on again.对我来说,文件第一次没有出现在文件资源管理器中,然后我关闭了模拟器并再次打开它。 Now it works!现在它起作用了!

in Eclipse, Open the DDMS Perspective.在 Eclipse 中,打开 DDMS 透视图。

Start an Emulator.启动模拟器。 Select it in the Devices.在设备中选择它。

Click on the File Explorer Tab in DDMS.单击 DDMS 中的文件资源管理器选项卡。

THEN THE FOLLOWING DOCUMENTATION FROM OFFICIAL ANDROID WEBSTIE: http://developer.android.com/tools/debugging/ddms.html然后来自官方 ANDROID WEBSTIE 的以下文档: http : //developer.android.com/tools/debugging/ddms.html

Working with an emulator or device's file system使用模拟器或设备的文件系统

DDMS provides a File Explorer tab that allows you to view, copy, and delete files on the device. DDMS 提供了一个文件资源管理器选项卡,允许您查看、复制和删除设备上的文件。 This feature is useful in examining files that are created by your application or if you want to transfer files to and from the device.此功能在检查由您的应用程序创建的文件时或如果您想将文件传输到设备或从设备传输文件时非常有用。

To work with an emulator or device's file system:要使用模拟器或设备的文件系统:

In the Devices tab, select the emulator that you want to view the file system for.在“设备”选项卡中,选择要查看其文件系统的模拟器。 To copy a file from the device, locate the file in the File Explorer and click the Pull file button.要从设备复制文件,请在文件资源管理器中找到该文件,然后单击拉取文件按钮。 To copy a file to the device, click the Push file button on the File Explorer tab.要将文件复制到设备,请单击文件资源管理器选项卡上的推送文件按钮。

Answer here also.也在这里回答。 You need not open cmd when using eclipse.使用eclipse时不需要打开cmd。

Problems trying to push files into android device using eclipse 尝试使用 eclipse 将文件推送到 android 设备的问题

You can use the ADB via a terminal to pass the file From Desktop to Emulator.您可以通过终端使用 ADB 将文件从桌面传递到模拟器。

adb push <file-source-local> <file-destination-remote>

You can also copy file from emulator to Desktop您还可以将文件从模拟器复制到桌面

adb pull <file-source-remote> <file-destination-local>

first,download magiciso( http://www.magiciso.com/Setup_MagicISO.exe )首先,下载magiciso( http://www.magiciso.com/Setup_MagicISO.exe )

after downloading When your emulator is not open go to your avd files(c:/document and settings/"user name"/.android)下载后当您的模拟器未打开时,转到您的 avd 文件(c:/document and settings/"user name"/.android)

there is your avd named folder有你的 avd 命名文件夹

then open sdcard.img with magiciso然后用magiciso打开sdcard.img

now you have to drag and drop files in your magic iso window现在你必须在你的魔法 iso 窗口中拖放文件

don't forget to save the file不要忘记保存文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM