如何在 Android 模拟器中安装 APK 文件? [英] How do you install an APK file in the Android emulator?

查看:51
本文介绍了如何在 Android 模拟器中安装 APK 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我终于设法混淆了我的 Android 应用程序,现在我想通过安装 来测试它APK 文件并在模拟器上运行它.

如何在 Android 模拟器上安装 APK 文件?

解决方案

您只需将应用程序的 .apk 文件拖放到模拟器中,它就会自动开始安装.

另一种选择:


Windows:

  1. 执行模拟器 (SDK Manager.exe->工具->Manage AVDs...-> 新建然后开始)
  2. 启动控制台(Windows XP),运行 ->输入cmd,移动到SDK目录下的platform-tools文件夹.
  3. APK 文件粘贴到android-sdk\tools"或platform-tools"文件夹中.
  4. 然后输入以下命令.

<块引用>

adb install [.apk 路径]

示例:

<块引用>

adb install C:\Users\Name\MyProject\build\Jorgesys.apk

Linux:

  1. 将 apk 文件复制到 android-sdk linux 文件夹中的 platform-tools.
  2. 打开终端导航到android-sdk中的platform-tools文件夹.
  3. 然后执行这个命令-

<块引用>

./adb install FileName.apk

  1. 如果操作成功(结果显示在屏幕上),那么您将在模拟器的启动器中找到您的文件.

苹果机:

PATH=$PATH:~/Library/Android/sdk/platform-tools

<块引用>

示例:PATH=$PATH:/users/jorgesys/eclipse/android-sdk-mac_64/tools

然后运行 ​​adb.

苹果机:

1.运行模拟器,

2.然后复制你的.apk文件并粘贴到/Users/your_system_username/Library/Android/sdk/platform-tools
如果您无法在您的 mac 系统中找到 sdk 路径,请执行以下步骤: 打开 finder->select 顶部菜单上的 Go 选项 ->选择转到文件夹选项 ->它将弹出一个带有文本字段的窗口:/Users/your_system_username/Library/Android/sdk/ ->现在打开平台工具文件夹并粘贴您复制的 .apk 文件,

  1. 现在打开终端并输入以下内容:cd Library/Android/sdk/platform-tools

  2. 在您的终端中执行以下命令:./adb install yourapkfilename.apk 如果您收到以下错误消息:error: no devices found - waiting for device,请按照第 5 步操作.

  3. 从 Android Studio 运行您的模拟器,一旦模拟器处于活动状态,然后重复第 4 步,您将在终端上看到成功消息.

I finally managed to obfuscate my Android application, now I want to test it by installing the APK file and running it on the emulator.

How can I install an APK file on the Android Emulator?

解决方案

You can simply drag and drop the .apk file of your application to the emulator and it will automatically start installing.

Another option:


Windows:

  1. Execute the emulator (SDK Manager.exe->Tools->Manage AVDs...->New then Start)
  2. Start the console (Windows XP), Run -> type cmd, and move to the platform-tools folder of SDK directory.
  3. Paste the APK file in the 'android-sdk\tools' or 'platform-tools' folder.
  4. Then type the following command.

adb install [.apk path]

Example:

adb install C:\Users\Name\MyProject\build\Jorgesys.apk

Linux:

  1. Copy the apk file to platform-tools in the android-sdk linux folder.
  2. Open Terminal and navigate to platform-tools folder in android-sdk.
  3. Then Execute this command -

./adb install FileName.apk

  1. If the operation is successful (the result is displayed on the screen), then you will find your file in the launcher of your emulator.

Mac:

PATH=$PATH:~/Library/Android/sdk/platform-tools

Example : PATH=$PATH:/users/jorgesys/eclipse/android-sdk-mac_64/tools

Then run adb.

Mac:

1.Run the emulator,

2.then copy your .apk file and paste into /Users/your_system_username/Library/Android/sdk/platform-tools,
if you are not able to find sdk path in your mac system, do the following steps: Open finder->select Go option on top menu -> select Go to Folder option -> it will popup a window with a textfield: /Users/your_system_username/Library/Android/sdk/ -> now open platform-tools folder and paste your copied .apk file,

  1. Now open the terminal and type the following: cd Library/Android/sdk/platform-tools

  2. execute the following in your terminal: ./adb install yourapkfilename.apk if you get the following error message: error: no devices found - waiting for device, follow step 5.

  3. Run your emulator from Android Studio, once emulator active then repeat step 4, you will see the success message on your terminal.

这篇关于如何在 Android 模拟器中安装 APK 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆