I was trying to install an app on my nexus 5 from intellij and for the first time i get an error saying
"DeviceMonitor: Adb rejected connection to client '5081': closed"
I tried restart my adb restart computer, disable, enable android debugging sync gradle. The weird thing is that when i try running it on a virtual device it works. Anyone has an idea? Here is the full error code :
DeviceMonitor: Adb rejected connection to client '5081': closed DeviceMonitor: Adb rejected connection to client '5064': closed DeviceMonitor: Adb rejected connection to client '4962': closed DeviceMonitor: Adb rejected connection to client '5081': closed DeviceMonitor: Adb rejected connection to client '5064': closed DeviceMonitor: Adb rejected connection to client '5064': closed DeviceMonitor: Adb rejected connection to client '3483': closed DeviceMonitor: Adb rejected connection to client '3483': closed
logcat shows nothing, i tried running it in terminal "adb logcat" and it showed normal either.
Adb connection Error:An existing connection was forcibly closed by the remote host. Cannot reach ADB server, attempting to reconnect.
Steps for connecting the Android with ADB over TCPConnect your android device with a laptop/pc using a USB cable. Then in the android device turn on developer options from settings, and in developer options turn on USB Debugging (PTP/ MTP).
I just had this issue, and Googling didn't yield a ton of results when I looked it up. Alchete's answer was what solved this issue for me, but being new to the Windows command line, I didn't know how to execute it. So I just want to elaborate in case anyone is in the same boat as I was.
Open the Start Menu and type cmd to get to the command line.
Change directories to get to the sdk folder that contains the adb.exe file.
For me the command looked like this:
cd Documents\Programming\android-studio\sdk\platform-tools
Adjust based on the path to your sdk folder.
Then, you can enter:
adb kill-server
Followed by:
adb start-server
I just had this problem as well. Closing and re-launching Android Studio had no effect.
The solution for me was to execute the following commands in a terminal window:
adb kill-server
adb start-server
After that, my Android device connected as normal.
I had the same problem recently.
I had moved the intent-filter tag in the AndroidManifest.xml file inorder to start a different activity.
What I had forgotten to do was change the run/debug target inside Android Studio. Click Run -> Edit configurations. Look at Launch string and check it matches the activity in AndroidManifest which has the launch XML inside it:
Launch XML:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
My reputation is not high enough, but I wanted to respond to say that Alex Lowe's and Alchete's answer worked for me, combined with andy boot's answer. (+1 to Alex Lowe for the detailed response).
Furthermore, restart your Android Studio session once you have killed the adb. The server should start right back up again.
If, like me, you are getting this error because you may have changed intent filters around in your Android Manifest, i.e. you created a Splash Screen and added the Category_Launcher intent
For example, CATEGORY_LAUNCHER means it should appear in the Launcher as a top-level application
..then you will want to make sure it is specified as your Launch Activity as previously explained (Run - Edit Configurations - Launch). "Launch default activity will initially be selected, but you want to change that to the new Activity you have specified as your Launcher.
Hopefully one of those two solutions will work!
Also, if you are having trouble finding the directory path for your Android SDK, go to your SDK Manager in Android Studio and the directory path should be at the top of the dialog box.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With