在 Mac OS 上的 android 模拟器上安装 apk

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11732467/
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 08:37:33  来源:igfitidea点击:

Installing an apk on android emulator on Mac OS

androidmacosemulationapk

提问by TruthOf42

I tried following these steps(from here):

我尝试按照以下步骤操作(从这里开始):

go to sdk folder, then go to tools.
copy your apk file inside the tool directory
./emulator -avd myEmulator
to run the emulator on mac 
./adb install myApp.apk
to install app on the emulator

But when I run "./emulator -avd phoneEmulator" (phoneEmulator is the name of my emulator) it just displays:

但是当我运行“./emulator -avd phoneEmulator”(phoneEmulator 是我的模拟器的名称)时,它只显示:

Phil-Knights-MacBook-Pro:tools philiplknight$ ./emulator -avd phoneEmulator
2012-07-30 22:44:33.377 emulator-arm[2859:80b] Warning once: This application, or a
library it uses, is using NSQuickDrawView, which has been deprecated. 
Apps should cease use of QuickDraw and move to Quartz.

It's as if that command is never returning.

就好像那个命令永远不会返回一样。

If I can't input the 2nd command ./adb install myApp.apkin that window, where do I call it?

如果我不能./adb install myApp.apk在那个窗口输入第二个命令,我应该在哪里调用它?

回答by Kirit Vaghela

  1. Open Terminal
  2. go to android-sdk-mac\platform-tools
  3. type ./adb install myApp.apk
  1. 打开终端
  2. 转到 android-sdk-mac\platform-tools
  3. 输入 ./adb install myApp.apk

回答by Diego Torres Milano

First of all, you SHOULD NOT copy APKs to the tools or any other SDK directory. Do not cdto the SDK directories, just add them to the PATHenvironment var or use their absolute path in command lines. Then, if you want to run the emulator and then execute command from the same terminal, send the process to background (&):

首先,您不应将 APK 复制到工具或任何其他 SDK 目录。不要cd添加到 SDK 目录,只需将它们添加到PATH环境变量或在命令行中使用它们的绝对路径。然后,如果要运行模拟器然后从同一终端执行命令,请将进程发送到后台 (&):

$ export PATH=$PATH:/path/to/sdk/tools:path/to/sdk/platform-tools
$ emulator -avd myEmulator &
$ adb install /path/to/my.apk

回答by Sonu

You can work around by:

您可以通过以下方式解决:

  1. You have a *.apk file with you if you don't have, download it.
  2. Open Android Studio and Run the emulator.
  3. Open the finderand go to the locationwhich contains your *.apk file.
  4. Drag that *.apkand drop into the emulatorand it will ask for confirmation after your confirmation it will install the *.apk in the emulator.
  5. You can find it in application menu once installation succeeds.
  1. 您有一个 *.apk 文件,如果没有,请下载它。
  2. 打开 Android Studio 并运行模拟器
  3. 打开取景器并转到位置其中包含你的* .apk文件
  4. 将该 *.apk拖放到模拟器中,它会在您确认后要求确认,它将在模拟器中安装 *.apk。
  5. 安装成功后,您可以在应用程序菜单中找到它。

回答by Frank Nguyen

You can work around by:

您可以通过以下方式解决:

  1. Upload yourapp.apk to internet. I.e: yourhost.com/yourapp.apk
  2. Run emulator
  3. Open internet browser on your emulator, visit link yourhost.com/yourapp.apk
  4. Download and install
  1. 将 yourapp.apk 上传到互联网。即:yourhost.com/yourapp.apk
  2. 运行模拟器
  3. 在模拟器上打开互联网浏览器,访问链接 yourhost.com/yourapp.apk
  4. 下载并安装

回答by Ajay Gautam

Am I the only one whose apps install in the emulator when I run them as Android Application from eclipse?

当我从 Eclipse 将应用程序作为 Android 应用程序运行时,我是唯一一个将应用程序安装在模拟器中的人吗?

I mean - why go though the trouble of adb when you could just use eclipse? (unless you have something against eclipse!)

我的意思是 - 当你可以只使用 eclipse 时,为什么还要去解决 adb 的麻烦?(除非你有什么反对日食的东西!)

回答by Vito Valov

Try this app. It will install the apk by just double clicking on it after you create an association to .apk files. It's all explained in the github source.

试试这个应用程序。在您创建与 .apk 文件的关联后,它只需双击即可安装 apk。这一切都在github源中进行了解释。

回答by TheSteve

adb can be run from a seperate terminal once this emulator boots up.

一旦这个模拟器启动,adb 就可以从一个单独的终端运行。

回答by Ashok Domadiya

May Be, Useful to all the command in MAC OS Terminal

可能对MAC OS 终端中的所有命令有用