Galaxy S7 Edge will not stay in software installation mode I've been suffering through this for a couple weeks now, hoping that an update would fix it, but now I don't know who to turn to. So, I develop apps for android and iOS. Typically I just test on my own phone, which is a Galaxy S7 Edge. When I got it, I looked up how to access developer mode and did that. I then turned on USB debugging, however, when I hooked up my phone, my Android Studio could not find the device. 

I looked at my options under the "Use USB for..." menu and picked 'Software installation'. My Android Studio found my device and I started using it to test apps. It worked great, so I didn't ask any questions, until a couple weeks ago, after a security update I started getting a weird error. Every time I was connected to my computer and I set my usb mode to Software installation, after about 30 seconds it would change to File Transfer mode on its own. 

I cannot be in Software installation mode for more than a minute at any given time, and when I am in File Transfer mode, my Android Studio won't register my phone as a debugging device. I downloaded the most recent update today, but that didn't fix my issue. I Googled the issue, but I can't find anyone who seems to have had this problem. Has anyone had this problem? Does anyone have a clue how to fix it?

Tl;dr: My phone cannot stay in Software installation mode long enough for me to download an app from Android Studio to test. I'm using 6.0.1
Sorry, not an answer but rather some information, too much to put into comments. perhaps this could help someone determine what could be hapening.

Scenario Windows 7, AS 2.1.2, Genymotion 2.8 (but initially using a 2.6 device API 22). Working fine for a few hours (actually a bit of a lie as had tablet plugged in as well but need to start somewhere in the viscous circle). Started ADM (Android Device Monitor) (better/easier feedback). Still OK (i.e just genymotion device visible).

1) Plugin in Lenovo A10-30 API 24 with MTP enabled but NOT USB Debug. All fine.

2) Switch to charging. No change in AS or ADM.

3) Turn on USB Debug. Immediately disconnects Genymotion Device and tries but fails to connect tablet (and less frequently, I think the Genymotion device). Log ADM extract :-

[2016-10-27 13:47:19 - DeviceMonitor] Adb connection Error:An existing connection was forcibly closed by the remote host
[2016-10-27 13:47:20 - DeviceMonitor] Connection attempts: 1
[2016-10-27 13:47:21 - DeviceMonitor] Adb connection Error:An existing connection was forcibly closed by the remote host
[2016-10-27 13:47:22 - DeviceMonitor] Connection attempts: 1
[2016-10-27 13:47:24 - DeviceMonitor] Connection attempts: 2
[2016-10-27 13:47:27 - DeviceMonitor] Adb connection Error:An existing connection was forcibly closed by the remote host
[2016-10-27 13:47:28 - DeviceMonitor] Connection attempts: 1
[2016-10-27 13:47:30 - DeviceMonitor] Adb connection Error:An existing connection was forcibly closed by the remote host
[2016-10-27 13:47:31 - DeviceMonitor] Connection attempts: 1
[2016-10-27 13:47:32 - DeviceMonitor] Adb connection Error:An existing connection was forcibly closed by the remote host
[2016-10-27 13:47:33 - DeviceMonitor] Connection attempts: 1
[2016-10-27 13:47:35 - DeviceMonitor] Adb connection Error:An existing connection was forcibly closed by the remote host
[2016-10-27 13:47:36 - DeviceMonitor] Connection attempts: 1
[2016-10-27 13:47:38 - DeviceMonitor] Adb connection Error:An existing connection was forcibly closed by the remote host
[2016-10-27 13:47:39 - DeviceMonitor] Connection attempts: 1
[2016-10-27 13:47:40 - DeviceMonitor] Adb connection Error:An existing connection was forcibly closed by the remote host
[2016-10-27 13:47:41 - DeviceMonitor] Connection attempts: 1
[2016-10-27 13:47:43 - DeviceMonitor] Adb connection Error:An existing connection was forcibly closed by the remote host
[2016-10-27 13:47:45 - DeviceMonitor] Connection attempts: 1
[2016-10-27 13:47:46 - DeviceMonitor] Adb connection Error:An existing connection was forcibly closed by the remote host
[2016-10-27 13:47:47 - DeviceMonitor] Connection attempts: 1
[2016-10-27 13:47:49 - DeviceMonitor] Connection attempts: 2


Adroid Monitor in AS shows the following message frequently (Genymotion devices shows Disconnected) :-

01-01 00:00:00.000 0-0/? E/Internal: An existing connection was forcibly closed by the remote host


4) After about 5 minutes turn USB Debug off on Tablet.

Aprrox 3 minutes later, after :-

[2016-10-27 13:54:07 - DeviceMonitor] Adb connection Error:An existing connection was forcibly closed by the remote host
[2016-10-27 13:54:08 - DeviceMonitor] Connection attempts: 1


Genymotion device is now re-connected.



6) Turn MTP on (File Transfers on on Tablet), USB Debug still off.

Other than the windows dialog, nothing changes (AS and ADM show Genymotion device as connected).

7) Turn USB Debug on on the Tablet (from developer options)

Basically the same happens again. So I stop USB debug on Tablet and wait.

8) Revoke USB debugging authorisation on the Tablet and try USB Debug again. Allow it always.

Same Again. So stop USB Debug on Tablet and wait another 3 minutes or so for the Genymotion device to reconnect.

9) Stop the Genymotion device. So nothing is connected.

10) Turn USB Debug on on the Tablet. Tablet connects OK.

11) Start Genymotion device connects OK and tablet still connected.

12) Plug in an an HTC Sensation XL (Android 4.0.3) same again but disconnects both the Tablet and the Genymotion device. Disconnect the HTC phone and wait the obligatory 3 minutes or so. Both reconnect.

13) Stop the Genymotion device (tablet still connected) and try connecting the HTC phone. HTC phone connects and the Tablet remains connected.

14) Start the Genymotion device, it connects and the other 2 (Tablet and Phone) remain connected.


  A thought, is it due to the Genymotion virtual device? Perhaps a virtual device must be the last to be connected. Perhaps you may
  be using an AVD if so perhaps try disabling that and see what happens
  (I can't use AVD I think due to having an AMD chip).


Updated 23/11/2016
In brief I don't think that Genymotion is the issue but perhaps Android Studio.

Today I purchased another Tablet, an Onix 10.1 Quad Core. Pretty similar spec to the Lenovo. The main difference being a smaller screen (1024x600). 

However, I have been experiencing similar issues connecting to it. That is the dreaded "An existing connection was forcibly closed by the remote host".

It appears to be even harder to get connected than the Genymotion devices.

My last successful attempt was made after numerous failed attempts and was when I closed and then restarted Android Studio. Hence why I now suspect that AS is perhaps the cause. If I look into this further I may update this with my findings.