Android Studio: java.io.IOException: An existing c

2019-02-16 05:23发布

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

5条回答
放荡不羁爱自由
2楼-- · 2019-02-16 05:51

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.

查看更多
Fickle 薄情
3楼-- · 2019-02-16 06:00

I also faced same problem, just change computer USB port and problem solved. or use genymotion emulator

查看更多
老娘就宠你
4楼-- · 2019-02-16 06:08

I closed my virtual devices, opened windows task manager, and killed all adb.exe tasks -- there was one constant one and another that would appear then disappear. Aftwerwards, i started my virtual device and everything worked again.

查看更多
做自己的国王
5楼-- · 2019-02-16 06:10

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.

查看更多
啃猪蹄的小仙女
6楼-- · 2019-02-16 06:11

Restarting adb.exe worked for me. (For windows, Just Go to taskManager and kills the adb.exe process and re-deploy)

查看更多
登录 后发表回答