Android 在 AVD 模拟器中如何查看 sdcard 文件夹?并将 apk 安装到 AVD?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10680992/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 04:35:10  来源:igfitidea点击:

In AVD emulator how to see sdcard folder? and Install apk to AVD?

androidandroid-emulatoravd

提问by Trikaldarshi

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.

我创建了一个Android 模拟器Android Virtual Device),但我无法找到我在创建它时构建的 SD 卡。

How can I find the SD card and its content and also how to install APKfiles to the AVD?

如何找到 SD 卡及其内容以及如何将APK文件安装到AVD

回答by N-JOY

  1. switch to DDMSperspective
  2. select the emulator in deviceslist, whose sdcard you want to explore.
  3. open File Explorertab on right hand side.
  4. expand tree structure. mnt/sdcard/
  1. 切换到DDMS视角
  2. 设备列表中选择模拟器,您要探索其 sdcard。
  3. 打开右侧的文件资源管理器选项卡。
  4. 展开树结构。mnt/sdcard/

refer to image belowenter image description here

参考下图在此处输入图片说明



To install apk manually: copy your apk to to sdk/platform-tools folder and run following command in the same folder

要手动安装 apk:将您的 apk 复制到 sdk/platform-tools 文件夹并在同一文件夹中运行以下命令

adb install apklocation.apk

回答by Ponmalar

I have used the following procedure.

我使用了以下程序。

Procedure to install the apk files in Android Emulator(AVD):

在 Android Emulator(AVD) 中安装 apk 文件的步骤:

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

检查您的安装目录(例如:C:\Program Files (x86)\Android\android-sdk\platform-tools),是否有 adb.exe)。如果此文件夹中不存在,请在此处下载附件,解压缩 zip 文件。您将获得 adb 文件,将这三个文件复制并粘贴到工具文件夹中

Run AVD manager from C:\Program Files (x86)\Android\android-sdk and start the Android Emulator.

从 C:\Program Files (x86)\Android\android-sdk 运行 AVD 管理器并启动 Android 模拟器。

Copy and paste the apk file inside the C:\Program Files (x86)\Android\android-sdk\platform-tools

将 apk 文件复制并粘贴到 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 successcommand

  • Go to Application icon in Android emulator, we can see the your application

  • 转到开始 -> 运行 -> cmd

  • 键入cd “C:\Program Files (x86)\Android\android-sdk\platform-tools”

  • 输入adb install example.apk

  • 得到成功命令后

  • 转到 Android 模拟器中的应用程序图标,我们可以看到您的应用程序

回答by petrsyn

These days the location of the emulated SD card is at /storage/emulated/0

这些天模拟SD卡的位置在 /storage/emulated/0

回答by Pawe? Nadolski

On linux sdcard image is located in:

在 linux sdcard 映像位于:

~/.android/avd/<avd name>.avd/sdcard.img

You can mount it for example with (assuming /mnt/sdcard is existing directory):

例如,您可以使用(假设 /mnt/sdcard 是现有目录)挂载它:

sudo mount sdcard.img -o loop /mnt/sdcard

To install apk file use adb:

要安装 apk 文件,请使用 adb:

adb install your_app.apk

回答by Prakash

DDMS is deprecated in android 3.0. "Device file explorer"can be used to browse files.

DDMS 在 android 3.0 中已弃用。“设备文件浏览器”可用于浏览文件。

回答by Yahya Arshad

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

如果您使用的是 Eclipse。选择设备后,您应该从右上角切换到 DDMS 视角,您可以看到文件夹树。要手动安装 apk,您可以使用 adb 命令

adb install apklocation.apk

回答by Padma Kumar

//in linux

//在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.imgthat is your sdcard file.

// 在您的主文件夹 .android 隐藏文件夹中,您可以找到打开的 avd 文件夹并检查您创建的 avd 名称打开它,您可以看到sdcard.img那是您的 sdcard 文件。

//To install apk in linux

//在linux下安装apk

$adb install ./yourfolder/myapkfile.apk

回答by Slimane MEHARZI

Drag & Drop

拖放

To install apk in avd, just manually drag and drop the apk file in the opened emulated device

要在 avd 中安装 apk,只需手动将 apk 文件拖放到打开的模拟设备中

The same if you want to copy a file to the sd card

如果要将文件复制到 SD 卡,则相同

回答by DILSHAD AHMAD

I have used the following procedure.

我使用了以下程序。

Android Studio 3.4.1

安卓工作室 3.4.1

View>Tool Windows>Device File Explorer

查看>工具窗口>设备文件资源管理器

enter image description here

在此处输入图片说明

回答by Dino Fancellu

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.

添加到 usefile DDMS/File Explorer 解决方案中,对于那些不知道的人,如果要读取文件,则需要选择文件查看器工具栏上的“从设备中提取文件”按钮。不幸的是,您不能直接拖出或双击阅读。