Android Studio: java.io.IOException: An existing connection was forcibly closed by the remote host
<p>I read many posts to fix this problem. None worked for me.</p>

<p><strong>Error:</strong></p>

<pre><code>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
</code></pre>

<p>I tried below</p>

<ol>
<li>Kill and start adb</li>
<li>Invalidate and restart android studio</li>
<li>Removed adb process in the taskbar</li>
<li>Restarted the device and pc</li>
<li>Restarted studio, clean and rebuild</li>
<li>Taskbar have only one adb.exe</li>
<li>Updated the driver from device manager</li>
</ol>

<p>Another device it is working. But previously both device worked fine for me.</p>

<pre><code>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
</code></pre>

<p><strong>Edited:</strong></p>

<p>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.</p>

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

<p><a href="https://i.stack.imgur.com/zmnMQ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/zmnMQ.png" alt="enter image description here"></a></p>