将 Bluestacks 连接到 Android Studio

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

Connect Bluestacks to Android Studio

androidandroid-studioadbbluestacks

提问by Harikrishnan

I have recently shifted to android studio. I would like to know how I can test my apps in Bluestacks app player. I had already had the bluestacks connected and working with eclipse using adb connect localhost:5555but it doesn't seem to work with android studio. Didn't find any help anywhere. If anyone has done this, please help.

我最近转移到android studio。我想知道如何在 Bluestacks 应用程序播放器中测试我的应用程序。我已经连接了 bluestacks 并使用了 eclipse,adb connect localhost:5555但它似乎不适用于 android studio。没有在任何地方找到任何帮助。如果有人这样做过,请帮忙。

采纳答案by Harikrishnan

I Solved it. I just had to add the path of android studio's platform-tools after removing my earlier eclipse's path. I don't know, maybe some conflict in the command.

我解决了。在删除我之前的 eclipse 路径后,我只需要添加 android studio 的平台工具的路径。我不知道,也许命令中有些冲突。

回答by K Tarun

Steps to connect Blue Stack with Android Studio

将 Blue Stack 与 Android Studio 连接的步骤

  1. Close Android Studio.
  2. Go to adb.exelocation (default location: %LocalAppData%\Android\sdk\platform-tools)
  3. Run adb connect localhost:5555from this location.
  4. Start Android Studio and you will get Blue Stack as emulator when you run your app.
  1. 关闭 Android Studio。
  2. 转到adb.exe位置(默认位置:%LocalAppData%\Android\sdk\platform-tools
  3. adb connect localhost:5555从这个位置运行。
  4. 启动 Android Studio,当您运行您的应用程序时,您将获得 Blue Stack 作为模拟器。

回答by JRichardsz

In my case I didn't needed start adb.exe. I only started the BlueStacks beforeandroid studio.

就我而言,我不需要启动 adb.exe。我只android studio之前开始使用 BlueStacks 。

After that when I press "Run"in android studio, bluestacks is detected as a new emulator.

之后,当我在 android studio 中按“运行”时,bluestacks 被检测为新的模拟器。

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

Regards.

问候。

回答by Said AKHROUF

world !

世界 !

No need to do execute batch command. With the current version, just run BLUESTACKS before ANDROID STUDIO

无需执行批处理命令。使用当前版本,只需在 ANDROID STUDIO 之前运行 BLUESTACKS

回答by Turrican

For those people with (cannot connect to localhost:5555: No connection could be made because the target machine actively refused it. (10061):

对于那些人(cannot connect to localhost:5555: No connection could be made because the target machine actively refused it. (10061)

Blustacks is listening at IPv4-Localhost-TCP-5555(not IPv6). Most of the time Windows has IPv6 enabled by default and Localhost is solving ::1:

Blustacks 正在侦听IPv4-Localhost-TCP-5555(不是 IPv6)。大多数情况下,Windows 默认启用 IPv6,Localhost 正在解决::1:

If the client (ADB) tries to connect a server using localhost and IPv6 is enabled on the main network adapter, ADB will not connect to the server.

如果客户端 (ADB) 尝试使用 localhost 连接服务器并且主网络适配器上启用了 IPv6,ADB 将不会连接到服务器。

So, you have two options :

所以,你有两个选择:

1- Change your ADB client TCP connection string to localhost IPV4 : adb connect 127.0.0.1

1- 将您的 ADB 客户端 TCP 连接字符串更改为 localhost IPV4 : adb connect 127.0.0.1

OR :

或者 :

2-Disable IPV6 protocol from the main network adapter.

2-从主网络适配器禁用 IPV6 协议。

回答by MohammadSoori

first open bluestacks and go to settings > preferences > check the Enable Android Debug Bridge (ADB) and press Change path button, then select adb path. (default location: %LocalAppData%\Android\sdk\platform-tools)

then install one apk in emulator (by click the installed apps > install apk in bluestacks home screen)

首先打开bluestacks并转到设置>首选项>选中启用Android调试桥(ADB)并按更改路径按钮,然后选择adb路径。 (default location: %LocalAppData%\Android\sdk\platform-tools)

然后在模拟器中安装一个 apk(通过单击已安装的应用程序 > 在 bluestacks 主屏幕中安装 apk)

after doing this works run cmd by administrator and got to adb path then run this command:

完成此工作后,由管理员运行 cmd 并进入 adb 路径,然后运行以下命令:

adb connect localhost:5555

now you can open VSCodde or AndroidStudio and select BlueStacks emulator.

现在您可以打开 VSCodde 或 AndroidStudio 并选择 BlueStacks 模拟器。

回答by PatsonLeaner

In my case, none of the above approaches worked for me till I had to enable an Android DEBUG Bridge Option under the BlueStack emulator. Check the picture below.

就我而言,在我必须在 BlueStack 模拟器下启用 Android DEBUG Bridge Option 之前,上述方法均不适合我。检查下面的图片。

An approach inspired from : Vlad Voytenko

灵感来自:Vlad Voytenko 的方法

enter image description here

在此处输入图片说明

I Hope It's Helps Someone!

我希望它可以帮助某人!