Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio: java.io.IOException: An existing connection was forcibly closed by the remote host

Tags:

I read many posts to fix this problem. None worked for me.

Error:

Target device: lenovo-lenovo_a6000-89a70dc9 Installing APK: C:\Users\Nikhil\AndroidStudioProjects\ProfitKey\app\build\outputs\apk\app-debug.apk Uploading file to: /data/local/tmp/helix.profitkey.hotelapp java.io.IOException: An existing connection was forcibly closed by the remote host 

I tried below

  1. Kill and start adb
  2. Invalidate and restart android studio
  3. Removed adb process in the taskbar
  4. Restarted the device and pc
  5. Restarted studio, clean and rebuild
  6. Taskbar have only one adb.exe
  7. Updated the driver from device manager

Another device it is working. But previously both device worked fine for me.

Target device: motorola-xt1022-ZX1B33PRVP Installing APK: C:\Users\Nikhil\AndroidStudioProjects\ProfitKey\app\build\outputs\apk\app-debug.apk Uploading file to: /data/local/tmp/helix.profitkey.hotelapp Installing helix.profitkey.hotelapp DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/helix.profitkey.hotelapp" pkg: /data/local/tmp/helix.profitkey.hotelapp Success 

Edited:

I tried with two lenovo A6000. One is working and another is not working. Then, Moto is working and samsung galaxy is not working. Whenever I am killing and starting the adb. The task manager creating two adb first and after few seconds one was hiding. Was this a problem? But still some devices working fine.

adb starts automatically after killing by command or from the task manager if android studio is opened.

enter image description here

like image 454
Abish R Avatar asked Mar 16 '16 08:03

Abish R


People also ask

How do you resolve an existing connection was forcibly closed by the remote host?

The error means the service is not running or the client cannot reach the remote system. You'll want to get the IP address (ipAddress) returned from your code to make sure the IP is the expected IP. While remoted into the server ping the remote IP address to see if the IP is reachable from your server.

What is IOException in Android Studio?

IOException is checked exception, which either need to be catch (or) re-throw.

What does Java IOException Connection reset by peer mean?

java. io. IOException in Netty means your game server tries to send data to a client, but that client has closed connection to your server.


2 Answers

Now working for all the devices. Just I uninstalled the driver of mobile in PC and changed the port to connect with that device. I think some problem with the port in my PC. After long research it fixed by a small thing. It might be helpful to someone.

like image 154
Abish R Avatar answered Sep 17 '22 15:09

Abish R


I also faced same problem,this was a just port problem,I was using computer front USB port ,just use computer back USB port and problem solved.

like image 26
Irfan Qureshi Avatar answered Sep 16 '22 15:09

Irfan Qureshi