如何在 Android Studio 的模拟器上安装 apk? [英] How to install an apk on the emulator in Android Studio?

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

问题描述

如何从终端在Android Studio的模拟器上安装apk?

How do you install an apk on the emulator in Android Studio from the terminal?

在 Eclipse 中我们做到了

In Eclipse we did

/home/pcname/android-sdks/platform-tools/adb -s emulator-5554 install /home/pcname/Downloads/apkname.apk

现在在 Android Studio 中怎么样?

Now how about in Android Studio?

推荐答案

尽管这个答案被标记为正确答案(在 2013 年),目前,正如下面的@user2511630 所回答的,您可以将 apk 文件直接拖放到模拟器中进行安装.

Even though this answer is marked as the correct answer (in 2013), currently, as answered by @user2511630 below, you can drag-n-drop apk files directly into the emulator to install them.

原答案:

无论您使用什么(Eclipse 或 Android Studio),您都可以将 .apk 文件安装到模拟器

You can install .apk files to emulator regardless of what you are using (Eclipse or Android Studio)

这就是我经常做的:(对于完全的初学者)

here's what I always do: (For full beginners)

1- 运行模拟器,等待它完全启动.

1- Run the emulator, and wait until it's completely started.

2- 转到您的 sdk 安装文件夹,然后转到 platform-tools(您应该看到一个名为 adb.exe 的可执行文件)

2- Go to your sdk installation folder then go to platform-tools (you should see an executable called adb.exe)

3- 创建一个新文件并命名为run.bat,用记事本编辑该文件并在其中写入CMD并保存.

3- create a new file and call it run.bat, edit the file with notepad and write CMD in it and save it.

4- 将你想要的 apk 复制到同一个文件夹

4- copy your desired apk to the same folder

5- 现在打开 run.bat 并编写 adb install "your_apk_file.apk"

5- now open run.bat and write adb install "your_apk_file.apk"

6- 等待安装完成

7- 瞧,您的 apk 已安装到您的模拟器上.

7- voila your apk is installed to your emulator.

注意:如果应用程序已经存在,请使用 adb install -r "your_apk_file.apk"

Note: to re-install the application if it already existe use adb install -r "your_apk_file.apk"

抱歉,我对初学者说的详细说明

sorry for the detailed instruction as I said for full beginners

希望对您有所帮助.

问候,

塔里克

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

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