如何使用android studio将文件推送到仿真器实例

时间:2021-12-22 18:55:08

How am I able to push .txt files to the emulator using Android Studio?

如何使用Android Studio将.txt文件推送到模拟器?

5 个解决方案

#1


31  

You can use the ADB via Terminal to pass the file From Desktop to Emulator.

可以使用ADB通过终端将文件从桌面传递到仿真器。

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

You can also copy file from emulator to Desktop

你也可以复制文件从模拟器到桌面。

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

How ever you can also use Android Device Monitor to access files. Click on the Android Icon which can be found in the toolbar itself.It'll take few seconds to load, Once it's loaded you can see a tab named File Explorer.now you could pull/push files from there.

还可以使用Android设备监视器来访问文件。单击可以在工具栏中找到的Android图标。加载它需要几秒钟的时间,一旦加载,您可以看到一个名为File Explorer的选项卡。现在你可以从那里拉/推文件。

#2


54  

If you want to do it using graphical interface you can follow this inside android studio menus:

如果你想使用图形界面进行操作,可以在android studio菜单中进行如下操作:

Tools --> Android --> Android Device Monitor

工具——> Android——> Android设备监控器。

如何使用android studio将文件推送到仿真器实例

Afterward, Android Device Monitor(DDMS) window will open and you can upload files using File Explorer. You can select an address like /mnt/sdcard and then push your file into sdcard. 如何使用android studio将文件推送到仿真器实例

之后,Android设备监控器(DDMS)窗口将打开,您可以使用文件资源管理器上传文件。您可以选择一个像/mnt/sdcard这样的地址,然后将文件推入sdcard。

Update:

更新:

In Android 6.0+, you should use same process but your android application cannot access files which pushed inside SDCARD using DDMS File Explorer. It is the same if you try commands like this:

在Android 6.0+中,您应该使用相同的进程,但是您的Android应用程序不能访问使用DDMS File Explorer在SDCARD中推送的文件。如果您尝试这样的命令,也是一样的:

adb push myfile.txt /mnt/sdcard/myfile.txt

If you face EACCES (Permission denied) exception, it means you have no access to files inside external storage, since it is a dangerous permission.

如果您面临EACCES(权限被拒绝)异常,这意味着您无法访问外部存储中的文件,因为这是一个危险的权限。

For this situation, you need to request access grant manually using new permission system in Android 6.0 and upper version. For details you can have a look in android tutorial and this link.

对于这种情况,您需要使用Android 6.0和更高版本中的新权限系统手动请求访问授权。有关详细信息,请参阅android教程和此链接。

#3


43  

One easy way is to drag and drop. It will copy files to /sdcard/Download. You can copy whole folders or multiple files. Make sure that "Enable Clipboard Sharing" is enabled. (under ...->Settings)

一个简单的方法是拖放。它会将文件复制到/sdcard/下载。您可以复制整个文件夹或多个文件。确保“启用剪贴板共享”被启用。(在…- >设置)

如何使用android studio将文件推送到仿真器实例

#4


11  

Android Device monitor is no longer available in android studio.

Android设备监视器在Android studio中不再可用。

If you are using android studio 3.0 and above. 1. Go to "Device File Explorer" which is on the bottom right of android studio. 2. If you have more than one device connected. select the device you want from the drop down list on top. 3. mnt>sdcard is the location for SD card on the emulator. 4. Right click on the folder and click Upload. See the image below.

如果您正在使用android studio 3.0或以上版本。1。进入“设备文件浏览器”,在android studio的右下角。2。如果有多个设备连接。从顶部的下拉列表中选择您想要的设备。3所示。sdcard是模拟器上SD卡的位置。4所示。右键单击文件夹并单击Upload。见下面的图片。

Note: You can upload folder as well not just individual files.

注意:你也可以上传文件夹,不只是个别文件。

如何使用android studio将文件推送到仿真器实例

#5


3  

Open command prompt and give the platform-tools path of the sdk. Eg:- C:\Android\sdk\platform-tools> Then type 'adb push' command like below,

打开命令提示符,并给出sdk的平台工具路径。- C:\Android\sdk\平台工具>,然后输入'adb push'命令如下,

C:\Android\sdk\platform-tools>adb push C:\MyFiles\fileName.txt /sdcard/fileName.txt

C:\ Android sdk \ \平台工具>亚行将C:\ myfile \文件名。txt / sdcard / fileName.txt

This command push the file to the root folder of the emulator.

此命令将文件推到仿真器的根文件夹。

#1


31  

You can use the ADB via Terminal to pass the file From Desktop to Emulator.

可以使用ADB通过终端将文件从桌面传递到仿真器。

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

You can also copy file from emulator to Desktop

你也可以复制文件从模拟器到桌面。

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

How ever you can also use Android Device Monitor to access files. Click on the Android Icon which can be found in the toolbar itself.It'll take few seconds to load, Once it's loaded you can see a tab named File Explorer.now you could pull/push files from there.

还可以使用Android设备监视器来访问文件。单击可以在工具栏中找到的Android图标。加载它需要几秒钟的时间,一旦加载,您可以看到一个名为File Explorer的选项卡。现在你可以从那里拉/推文件。

#2


54  

If you want to do it using graphical interface you can follow this inside android studio menus:

如果你想使用图形界面进行操作,可以在android studio菜单中进行如下操作:

Tools --> Android --> Android Device Monitor

工具——> Android——> Android设备监控器。

如何使用android studio将文件推送到仿真器实例

Afterward, Android Device Monitor(DDMS) window will open and you can upload files using File Explorer. You can select an address like /mnt/sdcard and then push your file into sdcard. 如何使用android studio将文件推送到仿真器实例

之后,Android设备监控器(DDMS)窗口将打开,您可以使用文件资源管理器上传文件。您可以选择一个像/mnt/sdcard这样的地址,然后将文件推入sdcard。

Update:

更新:

In Android 6.0+, you should use same process but your android application cannot access files which pushed inside SDCARD using DDMS File Explorer. It is the same if you try commands like this:

在Android 6.0+中,您应该使用相同的进程,但是您的Android应用程序不能访问使用DDMS File Explorer在SDCARD中推送的文件。如果您尝试这样的命令,也是一样的:

adb push myfile.txt /mnt/sdcard/myfile.txt

If you face EACCES (Permission denied) exception, it means you have no access to files inside external storage, since it is a dangerous permission.

如果您面临EACCES(权限被拒绝)异常,这意味着您无法访问外部存储中的文件,因为这是一个危险的权限。

For this situation, you need to request access grant manually using new permission system in Android 6.0 and upper version. For details you can have a look in android tutorial and this link.

对于这种情况,您需要使用Android 6.0和更高版本中的新权限系统手动请求访问授权。有关详细信息,请参阅android教程和此链接。

#3


43  

One easy way is to drag and drop. It will copy files to /sdcard/Download. You can copy whole folders or multiple files. Make sure that "Enable Clipboard Sharing" is enabled. (under ...->Settings)

一个简单的方法是拖放。它会将文件复制到/sdcard/下载。您可以复制整个文件夹或多个文件。确保“启用剪贴板共享”被启用。(在…- >设置)

如何使用android studio将文件推送到仿真器实例

#4


11  

Android Device monitor is no longer available in android studio.

Android设备监视器在Android studio中不再可用。

If you are using android studio 3.0 and above. 1. Go to "Device File Explorer" which is on the bottom right of android studio. 2. If you have more than one device connected. select the device you want from the drop down list on top. 3. mnt>sdcard is the location for SD card on the emulator. 4. Right click on the folder and click Upload. See the image below.

如果您正在使用android studio 3.0或以上版本。1。进入“设备文件浏览器”,在android studio的右下角。2。如果有多个设备连接。从顶部的下拉列表中选择您想要的设备。3所示。sdcard是模拟器上SD卡的位置。4所示。右键单击文件夹并单击Upload。见下面的图片。

Note: You can upload folder as well not just individual files.

注意:你也可以上传文件夹,不只是个别文件。

如何使用android studio将文件推送到仿真器实例

#5


3  

Open command prompt and give the platform-tools path of the sdk. Eg:- C:\Android\sdk\platform-tools> Then type 'adb push' command like below,

打开命令提示符,并给出sdk的平台工具路径。- C:\Android\sdk\平台工具>,然后输入'adb push'命令如下,

C:\Android\sdk\platform-tools>adb push C:\MyFiles\fileName.txt /sdcard/fileName.txt

C:\ Android sdk \ \平台工具>亚行将C:\ myfile \文件名。txt / sdcard / fileName.txt

This command push the file to the root folder of the emulator.

此命令将文件推到仿真器的根文件夹。