Android: Adb rejected connection to client - android

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.

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.

I had the same problem which in my case was due to having erroneously selected wear instead of app (and the watch feature was optional, see e.g. android studio error : missing feature: WATCH for details). The GUI was stuck in "waiting for phone" forever.

Related

Not able to debug app on android device - Android Studio 2.0

I am not able to debug an app on my device (Asus Zenphone 2) after I updated android studio to 2.0. I keep seeing below message in debug tab right after I click on debug icon in Android studio.
Message in debug tab in Android Studio UI
---------------------------------------------------------------
Waiting for application to come online: packagename
Waiting for application to come online: packagename
Waiting for application to come online: packagename
Waiting for application to come online: packagename
I keep seeing Alert Dialog with the title "Waiting for Debugger" and Force close button all the time.
I searched but it seems only two results from google for that message.
I restarted Android studio, checked developer settings on phone...
Have anyone faced with this issue. Please help me. I cannot run the emulator, because my mac will be too lag. Thank you in advance.
The problem is that after installing and starting to launch the app, that debugger client that AndroidStudio starts is unable to connect to the debugger server on the device. This can have many causes, see this answer and the other answer shown on this page and see if one solves the problem for you
To help figure out the problem, look at the 'Console' tab of the 'Debugger' window in AS. One of the first few lines should look like this:
$ adb shell am start -n "com.acme.audtest/com.acme.AudTest" -a
android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Cut and paste that line into a command prompt, REMOVE THE '-D', and execute it.
It your app ('AudTest') comes up without error, the problem is in AS, is communication to the device, or the configuration of the device. If the app doesn't start, it is in the .apk. (Not the complete solution, but starts to point you in the right direction -- for which of the solutions below applies to your situation.)
First I select the second option, and it worked fine. But then don't know why I change to select first option. So, the debugger shows the message Waiting for application to come online forever. And I did not notice that, just thought another app prevent me debug or that was an issue with Android Studio 2.0.
So, just check to second option will solve my issue. Thank all.
Restarting Android Studios (2.1.1) resolved this for me.
There are two possibilities:
1.USB Debugging off :
Start Developer Option of your devices
Switch On USB Debugging
2.In Android-Studio : File -> Invalidate Caches / Restart
anyone can be useful for you.Try it
The correct answer is close your Android Device Manager.
None of these suggestions worked for me till I closed it.
For me the problem was in "Android Studio" + "Intellij IDEA" running side-by-side. Was fixed by disabling bundled "Android plugin" in "Intellij IDEA".
(Note: problem appeared only with some later versions of these IDEs)
Nothing worked for me except one solution...
Clearing the Intellij IDEA (Android Studio) .idea directory which contains configuration information worked for me:
Exit Android Studio
Navigate to the project you are trying to debug
Backup any files inside .idea that you modified (if your project checks any of these into VCS)
Delete .idea directory
Open the project in Android Studio
I had to remove the parameter
android:exported = "false"
from the main activity.
if you get this problem on the emulator, running adb reconnect worked for me. there is a similar command for devices adb reconnect device
**
This answer might help for those Who have successfully connected their
device along netbeans NB Android but on debug there's no application
being appear on device.
**
Ok so solution is check your android device version in mobile setting click on about device at last: you will know your android version there.
Now choose the same version for your netbeans android project.
Right click on project name click on properties and then change target with same as your android device.
(In my case android version was 4.4.2 so I selected the same for my project target)
Before to go ahead click on service tab next to project tab in netbeans then right click on Android device and click on restart ADB.
Finally you need to right click on project again and click on clear and build.
Now you can run with hope to get result.
I just wanted to share my experience as I had the same error and there was no way to solve it using all the solutions you guys posted. I even deleted several times my virtual device, no way to make it work again.
In my App I have a custom permission com.example.CUSTOM_PERMISSION and I wanted to use it to protect my Main Activty from a confused deputy attack.
<permission android:name="com.example.CUSTOM_PERMISSION"
android:label="#string/permlab_deadlyActivity"
android:description="#string/permdesc_deadlyActivity"
android:permissionGroup="android.permission-group.COST_MONEY"
android:protectionLevel="dangerous" />
.
.
.
<activity
android:permission="com.example.CUSTOM_PERMISSION"
android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
Somehow that property android:permission was preventing my app to install and run on the virtual device, even though it could be compiled and build with Gradle successfully.
Just after removing it, everything is fine again
I am not sure the app is protected this way, I'm building another test app to try performing a confuse deputy and see if the declaration of the custom is just enough.
Hope this can help somebody that was getting mad like me!
I had this problem in the Android emulator, and it was solved by going to Tools->AVD Manager, selecting the device, right click "Cold Boot Now".
The solution which helped me is to click on attach the debugger to android Process and set debugger to java.
Just throwing my experience in as this just started happening. With regards to all these answers, I tried a few of them and none seemed to work. So I started from scratch:
Initial setup:
- USB Debugging ENABLED
- Always prompt when connecting to USB (I usually only connect in charge mode)
- Allow ADB debugging in charge only mode ENABLED
- Wait for debugger DISABLED
- Verify apps over USB ENABLED
The steps I took to get debugging back:
Close down Android Studio - I didn't go so far as to delete the .idea folder as discussed, but I'm sure it couldn't hurt.
DISABLE USB Debugging
Revoke USB debugging authorizations
Reconnect Device
$ adb devices
> <Device Id> unauthorized
ENABLED USB Debugging
Reconnect Device
When prompted select ALLOW (I clicked always allow)
$ adb devices
> <Device Id> device
Open Android Studio and hit debug - Application started successfully, I was still getting 5-6 of these messages but then it worked:
$ adb shell am start -n "com.exampleapp/com.exampleapp.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Waiting for application to come online: com.exampleapp.test | com.exampleapp
Waiting for application to come online: com.exampleapp.test | com.exampleapp
Waiting for application to come online: com.exampleapp.test | com.exampleapp
Connecting to com.exampleapp
Connected to the target VM, address: 'localhost:8600', transport: 'socket'
React Native
As a side note - this happens every so often, I'm not sure whether it's from switching back and forth between running from react-native run-android or debugging in Android Studio, but regardless I've had to do this a couple times (finally decided to document).
Also remember
$ adb reverse tcp:8081 tcp:8081
and to start the packager when debugging (I tend to forget).
Try to restart ADB. Execute terminal commands:
adb kill-server
adb start-server
I had this problem and none of the solutions provided worked for me.
I you had the same issue, you can also try this:
Edit Run/Debug configurations
Select the 'app' or other name's configuration
At the launch Options, change Launch "Nothing" to "Default Activity".
Steps

Can't Run my android app. Android Studio shows is as DEAD

I'm starting the android tutorial at udacity. This course consist on creating a weather app sunshine. At the end of lesson 1 when I try to run my app, android studio marked it as DEAD.
I tried all the steps in a similar problem however the problem remain the same. Here is the adb logs:
DeviceMonitor: adb restarted
PropertyFetcher: ShellCommandUnresponsiveException getting properties for device emulator-5554: null
DeviceMonitor: ExecutionException getting info for device emulator-5554
DeviceMonitor: Adb rejected connection to client '14794': closed
Remove your device (Samsung GT-I9060I) from USB.
Close Android Studio.
Open Task Manager and kill all processes named adb.exe.
Open Android Studio and wait until Gradle build is finished.
Connect your device as emulator again.
Run your app.
Btw, I also faced this issue a month ago, and those steps help me.
I actually rebuild my application and it works. I have no explanation . I guess it has something with Android studio.
The ADB still works unstable, and never mind which IDE are used Eclipse or new Android Studio.
The workaround for this is to restart adb.
Type in console:
adb kill-server
adb start-server
* daemon not running. starting it now at tcp:5037 *
* daemon started successfully *
Usually, this is enough condition to solve the issue for some time.

Warning: debug info can be unavailable. Please close other application using ADB: Monitor, DDMS, Eclipse . ANDROID STUDIO [duplicate]

I am trying to debug an app with Intellij 13.0 on Windows 7.
Whenever I start debugging I get the following warning:
Warning: debug info can be unavailable. Please close other application using ADB: Monitor, DDMS, Eclipse"
I have tested it on a device and in the emulator.
The only thing I have open is Intellij. I tried also with closing adb before I start debugging, but nothing changed.
For me this situation occured when device was connected via usb and adb tcpip was enabled (ADB in Wi-Fi mode).
Just run command adb usb with connected device and try to debug again.
Turn the USB Debugging on Device in Developer Options to off.
And then switch it back on.
This solved the issue in my case.
UPDATE
One more thing which fixed my case was clearing all existing breakpoints. And then trying to debug again.
I used adb kill-server in the console to get the Logcat to appear. Running Android Studio 1.02.
For those who are using Android-Studio: check your gradle file and product flavours and be sure that "debuggable" attribute in manifest is NOT set to false.
First make sure you close any application use ADB , DDMS
like if you open Eclipse with android studio
Second restart your ADB from terminal
adb kill-server
adb start-server
if you cannt find terminal use this image to guide you
if this doesn't work with you close android studio and open it again
the cause of error , many application share ADB this why you cant start debugging
Had similar problem in Android Studio (0.5.1) with SDK 18.0.1
Warning: debug info can be unavailable. Please close other application using ADB: Monitor, DDMS, Eclipse
As you suggested updating the SDK worked. Now running on 19.0 and the problem got resolved.
You can restart ADB in windows without writing any commands.
Just open Task Manager
Sort the list by name
Find process named "adb"
Right click on it and then select "End Task"
Done
Next time you run any app the adb will start with a new instance.
A pretty straight forward solution is running the following commands in the command Terminal of Android Studio :
adb kill-server
adb start-server
and then try debugging again. It should be working now.
The same issues occured with me all of a sudden while debuging an app on my samsung galaxy S6
This is what worked for me :
closed android studio
killed adb , using adb kill-server
removed all of my previous breakpoints(debug points)
Restarted android studio and my phone
Restaterted Mac
did a debug without any breakpoint.
Then again did debug by putting the breakpoints again in my code, Eureka it worked. Luckily it burned only half hour of mine.
This is a problem of ADB connections as sometimes ADB cache a dead connection on your real/virtual device and due to which the port is busy and u cannot connect to it.
The simplest solution to this is RESTART your ANDROID phone that's it.
Are you using adb through WiFi? That might cause debugging issues.
If so connect your mobile to your pc thru usb and debug again that should fix it.
This happened to me and the thing I did was to set
android:debuggable="true"
in <application> tag...like:
<application android:allowBackup="true"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:largeHeap="true"
android:icon="#drawable/icon"
android:debuggable="true"
>
This fixed the problem with later SDKs.
Below steps worked for me(If you are connected via USB debugging),
Go to the Developer options of the phone
Disable USB debugging and all other authorisations for USB debugging.
Enable back all
Now try to debug again, hope it will work.

Cannot debug android app in Intellij: "Warning: debug info can be unavailable."

I am trying to debug an app with Intellij 13.0 on Windows 7.
Whenever I start debugging I get the following warning:
Warning: debug info can be unavailable. Please close other application using ADB: Monitor, DDMS, Eclipse"
I have tested it on a device and in the emulator.
The only thing I have open is Intellij. I tried also with closing adb before I start debugging, but nothing changed.
For me this situation occured when device was connected via usb and adb tcpip was enabled (ADB in Wi-Fi mode).
Just run command adb usb with connected device and try to debug again.
Turn the USB Debugging on Device in Developer Options to off.
And then switch it back on.
This solved the issue in my case.
UPDATE
One more thing which fixed my case was clearing all existing breakpoints. And then trying to debug again.
I used adb kill-server in the console to get the Logcat to appear. Running Android Studio 1.02.
For those who are using Android-Studio: check your gradle file and product flavours and be sure that "debuggable" attribute in manifest is NOT set to false.
First make sure you close any application use ADB , DDMS
like if you open Eclipse with android studio
Second restart your ADB from terminal
adb kill-server
adb start-server
if you cannt find terminal use this image to guide you
if this doesn't work with you close android studio and open it again
the cause of error , many application share ADB this why you cant start debugging
Had similar problem in Android Studio (0.5.1) with SDK 18.0.1
Warning: debug info can be unavailable. Please close other application using ADB: Monitor, DDMS, Eclipse
As you suggested updating the SDK worked. Now running on 19.0 and the problem got resolved.
You can restart ADB in windows without writing any commands.
Just open Task Manager
Sort the list by name
Find process named "adb"
Right click on it and then select "End Task"
Done
Next time you run any app the adb will start with a new instance.
A pretty straight forward solution is running the following commands in the command Terminal of Android Studio :
adb kill-server
adb start-server
and then try debugging again. It should be working now.
The same issues occured with me all of a sudden while debuging an app on my samsung galaxy S6
This is what worked for me :
closed android studio
killed adb , using adb kill-server
removed all of my previous breakpoints(debug points)
Restarted android studio and my phone
Restaterted Mac
did a debug without any breakpoint.
Then again did debug by putting the breakpoints again in my code, Eureka it worked. Luckily it burned only half hour of mine.
This is a problem of ADB connections as sometimes ADB cache a dead connection on your real/virtual device and due to which the port is busy and u cannot connect to it.
The simplest solution to this is RESTART your ANDROID phone that's it.
Are you using adb through WiFi? That might cause debugging issues.
If so connect your mobile to your pc thru usb and debug again that should fix it.
This happened to me and the thing I did was to set
android:debuggable="true"
in <application> tag...like:
<application android:allowBackup="true"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:largeHeap="true"
android:icon="#drawable/icon"
android:debuggable="true"
>
This fixed the problem with later SDKs.
Below steps worked for me(If you are connected via USB debugging),
Go to the Developer options of the phone
Disable USB debugging and all other authorisations for USB debugging.
Enable back all
Now try to debug again, hope it will work.

Emulator problem in Android

When I launch the emulator I face many problems (Errors):-
HttpConnectionApp]emulator-5554 disconnected!
Cancelling 'net.paxcel.http.HttpConnectionApp activity launch'!
Emulator]emulator: ERROR: the user data image is used by another emulator.
aborting
Each time I have to re-run it but all in vain.
How can I improve this so that I can re-run the application on same AVD?
I had the same issue after my computer locked up and I had to power cycle it.
Wiping the user data didn't fix my problem, I had to delete the following folders manually
C:\Users\%UserName%\.android\avd\AVD2.1.avd\cache.img.lock
C:\Users\%UserName%\.android\avd\AVD2.1.avd\userdata-qemu.img.lock
A quick-fix that obviously works is to restart the adb server each time this error occurs:
adb kill-server && adb start-server
Then, you simply run the application again (without restarting AVD) and that's it.
Run configurations → Target → Wipe user data → Run.
It fixed the problem in my case.
Here is the answer that helped me:
link text
Another solution for me is start the avd manager and start once emulator from there. After that everything turns to normal.
AFAIK, this happens when an emulator is started, but the Android Debug Bridge couldn't establish connection to it.
If you have just started the emulator with your application, watch if you get Waiting for HOME to launch... or something similar in your Console.
If you don't get that message, but the emulator has been started, chances are, you'll get into the ERROR: the user data image is used by another emulator situation again.
emulator: ERROR: the user data image is used by another emulator. aborting
Tried restarting the computer as I had done a lot of messing around earlier but no joy same error.
Went to shut down ADB so as I'm on XP I run > cmd then paste in > cd C:\Program Files\Android\android-sdk\platform-tools (the location of the location for the ADB on XP)
Tried
adb kill-server && adb start-server
Then moved the directories cache.img.lock and userdata-qemu.img.lock in the C:\Documents and Settings\.android\avd\ to a New folder (instead of deleting)
This worked fine.
Delete the existing emulators and then make a new one.
This worked for me, when I had this problem and couldn't find the folders to delete.
Under Run Configurations --> Target --> Add Command Line Options add this
adb kill-server && adb start-server
every time running your App will kill-restart the adb server.
It's probably a bad install of ADT. Try uninstalling the plugin, restarting Eclipse, then installing it again fresh.
That of you aren't letting the emulator boot all the way up and are closing it before ADT/ADB can install/run your app.
Please set wipe_data for emulator
Use same instance of application (after modification if any) to avoid error you are getting.
This can also happen if you're using a network share as your home folder, because some network file sharing systems may lock the image files.
Delete the directories cache.img.lock and userdata-qemu.img.lock (in my case these files are in /mylocalusername/.android/avd/avd7.avd
Thanks for this! Just to add for some people who develop in Windows XP.
The path to the avd directory can be C:\Documents and Settings\.android\avd
Thanks again for the answer! :)

Categories

Resources