I/O 错误连接被拒绝 android studio

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

I/O Error Connection refused android studio

androidmacos

提问by user3387718

WhenI run a project in android studio, I get this error - I/O Error: Connection refused

当我在 android studio 中运行一个项目时,出现此错误 - I/O 错误:连接被拒绝

The emulator starts fine but doesn't pull in/reflect my project

模拟器启动正常,但没有拉入/反映我的项目

Device connected: emulator-5554
Device is online: emulator-5554
Target device: Nexus4 [emulator-5554]
Uploading file
local path: /Users/martinsjolte/AndroidStudioProjects/FirstAPP1/Firstapp1/build/apk/Firstapp1-debug-unaligned.apk
remote path: /data/local/tmp/dk.first.Firstapp1
Installing dk.first.Firstapp1
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/dk.first.Firstapp1"
Device disconnected: emulator-5554

Launching application: dk.first.Firstapp1/dk.first.Firstapp1.MainActivity.
DEVICE SHELL COMMAND: am start -n "dk.first.Firstapp1/dk.first.Firstapp1.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER

I/O Error: Connection refused

I/O 错误:连接被拒绝

My platform is a mac osx ver.12.9.1

我的平台是 mac osx ver.12.9.1

回答by CtrlX

Ok, I don't know if i got "the" answer. but here is how I've solved the same issue on my environnement ( Windows 8/Android Studio, but same error with ADT or eclipse) :

好吧,我不知道我是否得到了“那个”答案。但这是我在我的环境中解决相同问题的方法(Windows 8/Android Studio,但 ADT 或 eclipse 出现相同错误):

Context of my issues :

我的问题的背景:

I've got an Asus PC, and with all the application suite installed by default. So I've found that one of this Asus app ( currently "Asus sync") was using adb and in fact, it was taking control of the emulator over my adb in the AndroidSDK directory.

我有一台 Asus PC,并且默认安装了所有应用程序套件。所以我发现这个华硕应用程序之一(目前是“华硕同步”)正在使用 adb,事实上,它正在 AndroidSDK 目录中通过我的 adb 控制模拟器。



How to fix as a PC user :

作为 PC 用户如何修复:

Go to Task manager( right click on task bar) , and look for "adb.exe" . Then right click on it and select "Open the directory". This will bring you to the responding adb. In my case it was Asus Sync, so I just had to unistall this software and everything works fine !

转到任务管理器(右键单击任务栏),然后查找“ adb.exe”。然后右键单击它并选择“打开目录”。这会将您带到响应的 adb。就我而言,它是 Asus Sync,所以我只需要卸载这个软件,一切正常!



How to fix as a Mac user :

作为 Mac 用户如何修复:

Go to Activity Monitor(/Applications/Utilities/), and look for "adb". Then try to kill the process. Then look if it solve your "Connection refused" in Android studio/ADT or eclipse

转到活动监视器(/Applications/Utilities/),并查找“ adb”。然后尝试终止该进程。然后看看它是否解决了你在 Android studio/ADT 或 eclipse 中的“连接被拒绝”



If still not working you can try :

如果仍然无法正常工作,您可以尝试:

  • Start a emulator ( with your AVD manager)
  • when finished loading, Open DDMS panel(in android studio : Menu Tools > Android > Monitors DDMS)
  • Look if you see your current running android emulator ( listed on the Devicepanel)
  • See if this line is kind of "flashing" ( connect/disconnect).
  • If so, you have probably a other adb instance running in conflict
  • If not, you can restart adbor reinstall your SDK
  • 启动模拟器(使用您的AVD 管理器
  • 加载完成后,打开DDMS 面板(在 android studio 中:Menu Tools > Android > Monitors DDMS)
  • 查看您是否看到当前正在运行的 android 模拟器(在“设备”面板上列出)
  • 看看这条线是否有点“闪烁”(连接/断开)。
  • 如果是这样,您可能有其他 adb 实例在冲突中运行
  • 如果没有,您可以重新启动 adb或重新安装您的 SDK

Hope this could help someone !

希望这可以帮助某人!

回答by Sujit Devkar

This issue occurs when Android Debug Bridge aka ADB is not responding to the request from Android Studio. I killed the process adb.exe and started it again. This solved my problem.

当 Android Debug Bridge 又名 ADB 未响应来自 Android Studio 的请求时,会出现此问题。我杀死了进程 adb.exe 并再次启动它。这解决了我的问题。

回答by ralphgabb

If you are using a real device :

如果您使用的是真实设备:

Just reconnect your device, make sure your cable are workable and you installed the proper drivers.

只需重新连接您的设备,确保您的电缆可用并且您安装了正确的驱动程序。

回答by Pranaysharma

For me the following worked(after I tried the above points mentioned by others):

对我来说,以下工作(在我尝试了其他人提到的上述几点之后):

  1. I tried debugging/running anther application. It was okay. So this pointed me to the direction that the current application has some problem
  2. if (point 1 == true) {I uninstalled the application from my phone manually }
  1. 我尝试调试/运行另一个应用程序。没关系。所以这给我指出了当前应用程序存在一些问题的方向
  2. if (point 1 == true) {我手动卸载了手机上的应用程序}

Then re-make/rebuild the application and debug/run worked

然后重新制作/重建应用程序并调试/运行工作

回答by Narendra Singh

I had the same problem, and my problem fixed by restarting the android-studio. Hope, that will help you too.

我遇到了同样的问题,通过重新启动 android-studio 解决了我的问题。希望,这也能帮助你。