如何在Android Studio中的模拟器上安装apk?

时间:2021-10-20 16:00:16

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

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

In Eclipse we did

在Eclipse中我们做到了

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

Now how about in Android Studio?

现在Android Studio怎么样?

9 个解决方案

#1


80  

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

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

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

这就是我经常做的事情:(适合初学者)

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

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

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

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

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

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

4- copy your desired apk to the same folder

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

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

5-现在打开run.bat并写入adb install“your_apk_file.apk”

6- wait until the installation is complete

6-等到安装完成

7- voila your apk is installed to your emulator.

7-瞧你的apk安装到你的模拟器。

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

注意:如果已经存在,请重新安装应用程序使用adb install -r“your_apk_file.apk”

sorry for the detailed instruction as I said for full beginners

对于我对初学者说的详细说明感到抱歉

Hope this help.

希望这有帮助。

Regards,

问候,

Tarek

塔里克

如何在Android Studio中的模拟器上安装apk?

如何在Android Studio中的模拟器上安装apk?

#2


100  

Run simulator -> drag and drop yourApp.apk into simulator screen. Thats all. No commands.

运行模拟器 - >将您的App.apk拖放到模拟器屏幕中。就这样。没有命令。

#3


29  

For those using Mac and you get a command not found error, what you need to do is

对于那些使用Mac并且您得到命令未找到错误的人,您需要做的是

type

类型

./adb install "yourapk.apk"

./adb install“yourapk.apk”

如何在Android Studio中的模拟器上安装apk?

#4


10  

Start your Emulator from Android Studio Tools->Android-> AVD Manager then select an emulator image and start it.

从Android Studio Tools-> Android-> AVD Manager启动模拟器,然后选择模拟器图像并启动它。

After emulator is started just drag and drop the APK Very simple.

启动模拟器后,只需拖放APK即可。

#5


8  

In android studio emulator to run an apk file just drag the apk into the emulator.The emulator will install the apk

在android studio模拟器中运行apk文件只需将apk拖入模拟器。模拟器将安装apk

#6


7  

Much easier is just to start your emulator, then go to sdk/platform-tools and use adb from there to install apk. Like:

更简单的是启动你的模拟器,然后转到sdk / platform-tools并使用adb从那里安装apk。喜欢:

adb install xxx.apk

adb install xxx.apk

It will install it on running emulator.

它将在运行的模拟器上安装它。

#7


2  

For Linux: once emulator is running, the following worked for me.

对于Linux:一旦模拟器运行,以下工作对我有用。

Because I installed the Android SDK on my home directory, I have the following file structure:

因为我在我的主目录上安装了Android SDK,所以我有以下文件结构:

  • home/Android/Sdk/platform-tools/adb

    家用/安卓/ SDK /平台工具/ ADB

  • home/AndroidStudioProjects/Metronome.adk

    家用/ AndroidStudioProjects / Metronome.adk

AndroidStudioProjects is a file folder I made for my Android projects. "Metronome.adk" is the file I want to run.

AndroidStudioProjects是我为Android项目制作的文件夹。 “Metronome.adk”是我想要运行的文件。

So, using Terminal from the home directory...

所以,从主目录使用终端...

./Android/Sdk/platform-tools/adb install ./AndroidStudioProjects/Metronome.adk

Being a Linux novice, I often forget the need to put the "./" in when trying to locate a file or run a command.

作为Linux新手,我经常忘记在尝试查找文件或运行命令时需要输入“./”。

After the command achieves "Success", the app is in the Apps area of the emulator and can be run.

在命令达到“成功”后,应用程序位于模拟器的“应用”区域中,可以运行。

#8


2  

Just drag APK file to android emulator it will install automatically.

只需将APK文件拖到Android模拟器,它将自动安装。

#9


0  

In Android Studio: View - Tool Windows - Gradle

在Android Studio中:查看 - 工具Windows - Gradle

In the Gradle tool window navigate to your :app - Tasks - install and then execute (by double-clicking): any of your install*tasks: e.g. installDebug, installRelease

在Gradle工具窗口中,导航到:app - Tasks - 安装然后执行(通过双击):任何install *任务:例如installDebug,installRelease

Note: the apk will also automatically installed when you Run your application

注意:运行应用程序时,apk也会自动安装

#1


80  

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

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

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

这就是我经常做的事情:(适合初学者)

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

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

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

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

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

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

4- copy your desired apk to the same folder

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

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

5-现在打开run.bat并写入adb install“your_apk_file.apk”

6- wait until the installation is complete

6-等到安装完成

7- voila your apk is installed to your emulator.

7-瞧你的apk安装到你的模拟器。

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

注意:如果已经存在,请重新安装应用程序使用adb install -r“your_apk_file.apk”

sorry for the detailed instruction as I said for full beginners

对于我对初学者说的详细说明感到抱歉

Hope this help.

希望这有帮助。

Regards,

问候,

Tarek

塔里克

如何在Android Studio中的模拟器上安装apk?

如何在Android Studio中的模拟器上安装apk?

#2


100  

Run simulator -> drag and drop yourApp.apk into simulator screen. Thats all. No commands.

运行模拟器 - >将您的App.apk拖放到模拟器屏幕中。就这样。没有命令。

#3


29  

For those using Mac and you get a command not found error, what you need to do is

对于那些使用Mac并且您得到命令未找到错误的人,您需要做的是

type

类型

./adb install "yourapk.apk"

./adb install“yourapk.apk”

如何在Android Studio中的模拟器上安装apk?

#4


10  

Start your Emulator from Android Studio Tools->Android-> AVD Manager then select an emulator image and start it.

从Android Studio Tools-> Android-> AVD Manager启动模拟器,然后选择模拟器图像并启动它。

After emulator is started just drag and drop the APK Very simple.

启动模拟器后,只需拖放APK即可。

#5


8  

In android studio emulator to run an apk file just drag the apk into the emulator.The emulator will install the apk

在android studio模拟器中运行apk文件只需将apk拖入模拟器。模拟器将安装apk

#6


7  

Much easier is just to start your emulator, then go to sdk/platform-tools and use adb from there to install apk. Like:

更简单的是启动你的模拟器,然后转到sdk / platform-tools并使用adb从那里安装apk。喜欢:

adb install xxx.apk

adb install xxx.apk

It will install it on running emulator.

它将在运行的模拟器上安装它。

#7


2  

For Linux: once emulator is running, the following worked for me.

对于Linux:一旦模拟器运行,以下工作对我有用。

Because I installed the Android SDK on my home directory, I have the following file structure:

因为我在我的主目录上安装了Android SDK,所以我有以下文件结构:

  • home/Android/Sdk/platform-tools/adb

    家用/安卓/ SDK /平台工具/ ADB

  • home/AndroidStudioProjects/Metronome.adk

    家用/ AndroidStudioProjects / Metronome.adk

AndroidStudioProjects is a file folder I made for my Android projects. "Metronome.adk" is the file I want to run.

AndroidStudioProjects是我为Android项目制作的文件夹。 “Metronome.adk”是我想要运行的文件。

So, using Terminal from the home directory...

所以,从主目录使用终端...

./Android/Sdk/platform-tools/adb install ./AndroidStudioProjects/Metronome.adk

Being a Linux novice, I often forget the need to put the "./" in when trying to locate a file or run a command.

作为Linux新手,我经常忘记在尝试查找文件或运行命令时需要输入“./”。

After the command achieves "Success", the app is in the Apps area of the emulator and can be run.

在命令达到“成功”后,应用程序位于模拟器的“应用”区域中,可以运行。

#8


2  

Just drag APK file to android emulator it will install automatically.

只需将APK文件拖到Android模拟器,它将自动安装。

#9


0  

In Android Studio: View - Tool Windows - Gradle

在Android Studio中:查看 - 工具Windows - Gradle

In the Gradle tool window navigate to your :app - Tasks - install and then execute (by double-clicking): any of your install*tasks: e.g. installDebug, installRelease

在Gradle工具窗口中,导航到:app - Tasks - 安装然后执行(通过双击):任何install *任务:例如installDebug,installRelease

Note: the apk will also automatically installed when you Run your application

注意:运行应用程序时,apk也会自动安装