Debugging with Android Studio stuck at "Waiting For Debugger" forever - android

UPDATE
The supposed duplicate is a question on being stucking in "Waiting For Debugger" when executing Run, while this question is on being stucking in "Waiting For Debugger" when executing Debug, the steps to produce the problem is different, and the solution(s) are different as well.
Whenever I try to use Android Studio's Debug function, the Run status would always stuck at:
Launching application: com.astrotek.parashoot.debug/com.astrotek.ptpviewer.StarterActivity.
DEVICE SHELL COMMAND: am start -n "com.astrotek.parashoot.debug/com.astrotek.ptpviewer.StarterActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.astrotek.parashoot.debug/com.astrotek.ptpviewer.StarterActivity }
While the device (Samsung Galaxy S3 Android 4.3) I'm debugging would display
This has being the case from Android Studio 0.8.8 all the way to 1.0. And on the same computer I can perform debugging using Eclipse on the same device without any issues.
So the question is what can I do to make Android Studio debugging work?
Update: The same thing happens when debugging on Nexus 7 (2013) running Android 5.0; and testing on another machine rendered the same result. I can't be the only one encountering this issue :-/
Update: Opened a bounty since this issue is so annoying. Even re-installing the app doesn't solve. Nexus 5 running Cyano, Win7 64. The ADB log is telling:
8568-8568/it.myapp:myprocess W/ActivityThread﹕ Application it.myapp is waiting for the debugger on port 8100...
8568-8568/it.myapp:myprocess I/System.out﹕ Sending WAIT chunk
Also, I can't find an easy way to disconnect nor reset ADB connection in Android Studio.

Obviously is yet another Android Studio, or rather ADB bug.
Just use this command to disable it.
adb shell am clear-debug-app
OR
Ensure there is nothing to wait for, by automatic uninstall from Device before each test-run, using Gradle's uninstallAll task, as mentioned in:
stackoverflow.com/Auto uninstall before install?

On some machines/projects the debugger do not attach automatically so you need to attach it manually (studio menu -> Run -> Attach debugger to Android process)

Restarting Testing device fix the issue for me.

Restarting Android Studio fix the issue for me.

After clicking on the run icon. If it is stuck waiting for a debugger means it is not attached to the app. You have to manually attach by clicking on Attach Debugger to Android process.
It is on the right side of the run icon. I had focus this icon in linked image.
Updated Image for Attach Debugger to Android process Icon

Debugger stopped connecting for me today and nothing worked until I tried the following:
Go to Run, Edit-Configurations, Miscellaneous Tab, uncheck 'skip installation if APK has not changed' Apply, OK.
Debugger started to connect again.

A similar question has been asked recently and the solution may work for some and is very quick.
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

This problem occurs when you open more than one instance of Android studio, so you need to attach the debugger manually like mentioned above.
You may need to close other instances of Android studio.

I faced this problem in android studio 3.0. Just restarted device solved.

Both of my dev machines have JDK 8 installed, the debugging function is restored once JDK 7.0.71 was installed and JAVA_HOME environmental variable was set to point to the new JDK.
Guess there's some compatibility issue between Android Studio + ADB + JDK8 (Eclipse + ADB + JDK8 works fine).

I tried the top three rated answers but failed. After rebooting my mobile, the problem is solved. No more long "Waiting for Debugger".

I just managed this problem, after several days of trying the above solutions.
So I closed the emulator, run AVD manager and in device menu choose - "wipe data"
So in next run I was free from stucked debugger.

When the Device displays the message go to Run->Attach debbuger, then select a debbuger. it'll start the activity.

This fixed it for me. Android Studio -> File -> Invalidate Caches & Restart...

I had the same problem. Restart my android phone device worked for me.

This solution works for me:
turning off the USB debugging from my device settings , and then turning it on again.
its Much quicker and easier than restart the device.

How it worked for me.
1 Start Android Device Monitor from Tools -> Android -> Android Device Monitor
2 Click on Stop for the process you are facing the issue from list of devices.

For me, the issue was: The Regional Format of Windows was ARABIC.
I simply changed the regional format to English (United States) and the error has fixed.
Steps to fix:
Go to Start -> type Region -> click on Region to open Region window -> from the Format dropdown, select English (United Stated) -> Click OK.
Restart Android Studio.

As for my case, running Android Studio Canary (preview release) along with the stable version was the problem. Running multiple instances of the same Android Studio flavor was OK, but mixing them often resulted in "Waiting For Debugger".

Most of the times this is caused because of the overload of resources and threads over the emulator. Or even for the lock of objects that GC couldn't set free: http://developer.android.com/intl/pt-br/tools/debugging/index.html
Usually, a single restart of it will solve the issue, but sometimes it asks for the IDE restart, so be sure to make both tests.
Another good test is trying to start the app in "Start mode" and then try the debug mode again...
P.S: Don't forget to kill each debug process in the IDE after each test. This will prevent your env to be more overloaded.

Android studio 3.0 and Above
Disable the instant Run

This also happens to me from time to time. Problem is that your app / device is configured to wait for debugger. In this case it is waiting for debugger before continuing execution of.
Option 1:
Attach debugger or run in debug mode. You can do this in Android Studio. Buttons to attach debugger and run in debug mode are located next to normal run mode (Bug and Bug with arrow).
Option 2:
Disable Wait for debugger. You can do this is developer settings. This option needs to be disabled in:
Root of Developer Options
Developer options -> Select debug app ->
-> Wait for debugger
This was tested on Android emulator in android studio. Other phones might have this setting different. If you can not find app's settings in debug, reinstalling app might work too.

I had the same problem. Restart my android device and closed the adb.exe process. With that I could solve the problem

Well, I guess there is a plethora of circumstances that can trigger this issue. I'm using IntelliJ Idea instead, but it's mostly the same than Android Studio. My solution for this problem:
Fastest way:
Right click on the class file that contains the main activity of your
project, and then on "Debug 'WhateverActivity'". This will create a
new run configuration that should debug fine.
Other solution, without creating a new run configuration:
Open Run/Debug configurations and within "Android app" pick the configuration you're using to debug your app.
Locate "Launch Options/Launch" there and set it to "Specified Activity" instead of "Default Activity".
In the "Launch" field just below the aforementioned option, click on the three ellipsis (three dots) button and select your main
activity.
At least it worked for me. I hope it works for others too.

Got it fixed according this solution: https://youtrack.jetbrains.com/issue/IDEA-166153
I opened <project dir>/.idea/workspace.xml replaced all the
<option name="DEBUGGER_TYPE" value="Auto" /> occurrences to
<option name="DEBUGGER_TYPE" value="Java" />
and restarted Android Studio

Open Command prompt and go to android sdk>platform-tools> adb kill-server
press enter
and again adb start-server
press enter

Non of this solutions worked for me.
In my case was that I was debugging an App from Intellij IDEA and at the same time with Android Studio. By just closing the Intellij IDEA and removing the app I was debugging just fixed my problem.

Make sure that your Active Build Variant is debug.
If you also want to make your release variant APK debuggable then make a simple change in app level build.gradle -
buildTypes {
release {
debuggable true
/*Your rest code*/
}
}

For me the problem was having IntelliJ open at the same time as Android Studio. I was using IntelliJ for back-end development at the same time as Android Studio for app development. Even though I was not doing any mobile device work with IntelliJ, it broke debugging in Android Studio.
Solution: Shutdown IntelliJ when debugging with Android Studio.

Restarting everything didn't work for me. What DID work was waiting for a few minutes while Android Studio unclogged itself. This was the first time I ran the debugger; after that, Android Studio fired up the debugger quickly.

Related

Timed out waiting for process to appear on device

I am having the following problem when running or debugging apps on a device or emulator with Android Studio. The application is installed but it is not started on the device (or emulator). In the Run window I can see the following:
Launching app on device.
Waiting for process to come online...
and after some time I see the following:
Timed out waiting for process to appear on 'device'...
I have attached a screenshot that shows the problem.
The problem started recently. I am using the latest version of Android studio (3.5.1) and a Google Pixel device running Android 10 but the problem happens on emulators and other devices running previous versions of Android. The problem also happens on two different computers, with different Android applications and devices - the common factor is Android studio. Finally, the problem seems to have started after I updated Android Studio to 3.5.
Does anyone know how to fix this problem? I have tried many things (clear cache, rebuild, invalidate and restart, etc) without success.
Any ideas?
You mentioned that restarting Android Studio didn't work for you...but it worked for me...
File > Invalidate Caches / Restart... > Just Restart
Android Studio 3.6.2
Build #AI-192.7142.36.36.6308749, built on March 18, 2020
There is a bug in the recent Android Studio release. You can revert to previous version or test it from command line.
For me the problem was that I accidentally removed the Launch of the Default Activity in the "Run > Edit Configurations..." option.
Just insert the "Default Activity" under "Launch Options" and your application will run again on your device.
For me, it took marking the build as "debuggable" in the application build.gradle file.
For example:
android {
//...
buildTypes {
// ...
releaseStaging {
debuggable true // <- add this line
signingConfig signingConfigs.release
applicationIdSuffix ".releaseStaging"
versionNameSuffix "-STAGING"
matchingFallbacks = ['release']
}
}
}
Remember to remove this before building release APKs though!!!
Even if I faced the timed out issue in one plus and followed steps that fixed for me.
Go to the respective app
Hold for 3 sec > App info> permissions> allow for storage>.
Next, go to adv settings> battery opt > check "Don't optimize.">
Come back and scroll down > display over other apps> enable....
Hope this helps.
I managed to fix the problem by uninstalling Android studio, deleting all relevant files in the user folder (including gradle cached files) and installing the latest version of Android studio. The problem seems to have been fixed after several months. Note that I am now using Android Studio 4.1.
Hey I had this same problem recently, I tried re-starting adb server but no luck, however when I uninstalled the APK present on my device. Then everything was back to normal.
When I tried to run it on a emulator which didn't have application already, it worked perfectly fine.
Hope this helps :) Thank You.
I tried most of the answers from here and on YouTube. What worked for me is updating my Android studio to the latest version; 4.0.
Everything was working fine for me, when I started getting the error described in this question. So I created and started using a different virtual device for the emulator, and it didn't have the problem.
I was using debugging over Bluetooth.
Giving Location permission to the WearOS app on my phone solved the problem for me.
(Bluetooth scan access is restricted in the modern android versions unless fine Location permission is granted)
In case it can help someone...
try one of the following:
Make sure device is not connected the same time via data cable and wifi
2.If you are connecting through wifi, try to connect via data cable.
3.Check maybe your device has some component or anything maybe like fingerprint interfering with the connection.
When these errors occur:
Message in Run
No communication with Run (stacktraces, System.out ...)
No restart button
Install the newest Android Studio version
Try on different virtual devices, some of them are glitched

android studio can't connect to debug devices

Android Studio can't connect to debug devices.
When I click the debug button, the debug tab shows me
Connecting to the target VM, address: 'localhost:8600', transport: 'socket'
in variables
When I tried again it told me
12:14:44 Error running Android Debugger (8600): Unable to open debugger port : java.io.IOException "handshake failed - connection prematurely closed"
and then debug tab show me this
Disconnected from the target VM, address: 'localhost:8600', transport: 'socket'
in variables
My Android Studio version is 0.4.4 #AI133-1005886
This problem has been haunting me for a long time.
i use OS X
in android studio:
tools->android->enable adb integration(this should be checked) uncheck this, then check again. this solved me this problem. (it restarts the adb integration)
This is how I solved same issue:
1) I don't think that it is important but I: updated all pending for update ADT stuff. And restarted OS. But I still was unable to debug
2) Next: I launched AS. Opened terminal and ran this:
./adb get-state
daemon not running. starting it now on port 5037 *
daemon started successfully *
As you can see daemon started automatically after I asked for its state. So I did not do nothing more. Just tried to debug and this time debugging worked.
P.S. After I restarted AS debugging continued working. So there was no need in terminal manipulations anymore
Well, what it worked for me:
I have change my /etc/hosts file and make sure that those 3 lines are on the bottom of the file:
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
This is how I solved same issue:
(1)remove or disconnect your phone !
(2) connect your phone again!
After failure of all the solutions. I made a work around:
1) Run the app normally.
2) Attach the debugger to android process.
I solved this problem just restarting my Android studio
I faced this error too. I had to disable Instant Run to get the Debugger working.
If you are using VirtualBox with Androidx86 OS then you need to wake up simulator first: Machine -> ACPI Shutdown (Host+U)
To everyone that hasn't solved this problem yet, ./adb get-state worked for me.
But, the second time I got this problem, the cause was the wrong item selected in a drop down menu called Select Run/Debug Configuration beside the debug button. Select App in that menu would solved the problem.
(Refer to answer to this question: Android Studio Always Disconnect Immediately after beginning "debug")
For me, there was one another instance of DDMS(other than Android studio) was running...I closed that and restarted the Debug ...started working.
If none of the other solutions worked for you (as it didn't for me), I suggest to try to do a clean reinstall of the Platform tools.
1 - Start the standalone SDK Manager.
From Android Studio: Tools->Android->SDK manager, SDK Tools tab, click start standalone SDK manager.
2 - Close Android Studio.
3 - In SDK manager, in the Tools folder: check Android SDK Platform-Tools and click on the Delete packages button in bottom right corner.
4 - In Explorer, delete the folder android-sdk-path\platform-tools.
5 - Back in SDK manager: re-check Android SDK Platform-Tools and click on the Install packages button.
In a Windows environment, I brought up Taskmgr and it showed many copies of the debugger running. Shutting down Android Studio and restarting it solved the problem.
What worked for me was install all new tools:
LLDB 2.3 (lldb;2.3)
CMake 3.6.3155560 (cmake;3.6.3155560)
GPU Debugging tools (extras;android;gapid;3)
Instant Apps Development SDK (extras;google;instantapps)
Hope it helps anyone.
in my case i edited etc/hosts's everything goes wrong.
clear files /etc/hosts debug work.
I also got this error, and the other answers didn't work for me.
I fixed it by removing
multiDexEnabled true
from my debug configuration in the build.gradle file.

Android Logcat is empty when debug with device in android studio

When I try to debug using android device in android studio Logcat shows nothing. But when I use emulator LogCat shows all the messages. How should view the Logcat messages when debugging on actual device?
Thank You !
In Android studio 0.8.0 you should enable ADB integration through Tools -> Android, before run your app. Then the log cat will work correctly. Notice that if you make ADB integration disabled while your app is running and again make it enable, then the log cat dosen't show anything unless you rebuild your project.
Restart the phone. And it solves magically
I was using Lenovo A7000plus powered by Android 6.0 M and found out that my Android Studio was unable to record the debug process, but somehow other's phone debug report could be recorded. Plus, I tried use Memu emulator and it recorded normally.
Strangely, that device was recognized by Android Studio and ready to be debugged, but no recorded debug report at all from all application that ran on the device. Of course, USB debug was tuned on.
What I did before, I turned off Developer option on that phone in order to play my favourite mobile game (F/GO) which forbids USB Debugging is turned on in the device.
A few hours later, after trying any method in Internet and not success, accidentally I found simple but strange solution that is Restart the phone. I restarted the phone while it was connecting to PC, and somehow the logcat showed all debug process in Logcat like normal.
It sounds like non-engineering solution at all, but that's really work for my case.
As of 0.4.0 I have noticed that the logcat tab does not work in the debugger window - only in the Android DDMS window (hit Alt+6 to bring up the working logcat while debugging). Awkward I know :)
In Android studio 1.0.2 or later: you should enable ADB integration through Tools -> Android, before run your app
In Android studio 1.* if logcat messages have disappeared for me helps the next trick:
Tools -> Android -> disable )) "enable ADB integration" (if it've been enabled)
Tools -> Android -> enable it again "enable ADB integration"
In 0.8.2 the DDMS window doesn't show up. However restarting the adb logcat windows by pressing Alt+6 (Twice, if it's already opened) fixes the issue. It worked for me.
I understand that this question is over 2 years old, but from my searches a few people are still having a persistent problem with this. One possible solution to this (which worked for me after two hours!) is that your phone settings may have its "Log Switch" set to off, hence it isn't sending your log data to the IDE.
Here is the solution - "Unable to open log device '/dev/log/main': No such file or directory"
Hope it helps!
If anyone's still having trouble with this despite trying all the answers here, just use System.out.println instead of log.* and your debug messages will output.
Updated: I finally got the cause of the problem in my case. If I switch of my device's wifi, the log shows. Otherwise, the log will not show. I tried several times and it the always show full logs when I turn off my wifi.
My device is: Gsmart Classic, OS: Android OS, v5.1 (Lollipop). I met the problem when I updated the gradle build tool from 'com.android.tools.build:gradle:2.0.0-alpha1' to 'com.android.tools.build:gradle:2.0.0-alpha3' in Android Studio 2.0-preview. After trying all the solutions with no luck, I tried un applied all the instant run choices and re-apply it again. Then the logs show up.
Note: if it still doesn't help. You can as well try to switch back-and-forth the back ground process limit. Unfortunately, I couldn't reproduce the error.
In Android Studio 2.x I used to have to restart to get it working but often switching back and forth between the applications works or running
adb kill-server;
adb start-server;
to restart adb fixes many things as well.
The problem seems to have different causes.
For me, the issue was that I had two emulators with the same name (I created it, deleted it, and then created it again with the same name). There were two emulator entries in the logcat dropdown and it was connected to the wrong one. All I had to do was switch to the other one. I prevented the problem permanently by renaming the emulator.
I believe that the problem has various causes for different users. I experienced the same issue with logcat not displaying any information when my application crashed, and we all know how frustrating this can be.
The following are the solutions that worked for me.
Invalidating caches and restarting android studio
In the developer option in your physical device make sure the logger Buffer size is set to 1MB per logger buffer.
Restart your physical device.
Hope this helps.

Apk only runs in debug mode. Apk started with "Run" in Eclipse stops on breakpoints

I note that this has been asked before but I haven't found an answer yet. The main tell tale of this problem is that Eclipse stops on break points when the apk has been deployed as "Run"
I've done these so far and none produce a correctly running "Run" build from Project shell -> Run As -> 1. Android Application
• Disconnecting, uninstalling and re installing the apk does not fix the problem (this is a tablet device, not an emulator.)
• Made all of the project and library projects write able using the file system
• Brand new projects work correctly e.g. they don't stop on breakpoints in "Run" mode in the same Eclipse workspace as the problem project
• Window -> Preferences -> Run/Debug(expand) -> Launching "Launch in debug mode when workspace contains breakpoints" is set to never
• Closed and opened Eclipse
• Killed all of the running processes under the "Debug" tab in that perspective
• Cleaned the entire workspace both in Eclipse IDE and manually by deleting the res and gen folders of the main and library project dependencies
• Checked for the occurrence of the word "debug" in the project build files
• Clean built the project from the command line using: ant clean then ant release
Interestingly enough, when I clean build from the command line then fresh-install the new apk, if Eclipse is open the debugger will attach to the running process and stop at the first break point! If Eclipse is closed, the program will wait for the debugger with the standard "Waiting for Debugger" dialog.
So something is broken in the build process (haven't figured out what all files are getting involved yet) and/or something in .metadata and/or some depenency.
edit
I've found a file at:
C:\Projects\Mobile\Android\.metadata\.plugins\org.eclipse.debug.core\.launches\MyProjectName.launch
in the xml:
<launchConfiguration type="com.android.ide.eclipse.adt.debug.LaunchConfigType">
Don't know if it's a clue, but if I delete the file Eclipse will just replace it with the same.
edit
*Confirmed that the project Runs correctly when built and run from another machine, so I suspect that it's my work machine's Eclipse workspace that's causing this issue. Maybe I need to throw out all of the workspace's metadata and start over.
I encountered same issue. The solution is, restarting your device. Good luck.
You said you have breakpoints?
Try:
Window -> Preferences -> Run/Debug(expand) -> Launching
There should be a section entitled "Launch in debug mode when workspace contains breakpoints"
If that is not on "Never" that would be your problem.
I have the same problem and I need 4 steps to resolve them:
Disconnect the device
Reboot the device
Clean and build all the projects in workspace.
Start the app in emulator in Run mode and check it's ok.
Start the app in the device in Run mode and all works ok.
Only restarting the device not works for me!
I've encountered same problem: I could run my application only in debug mode, but it won't properly start when I press 'run' button. I've tried all solution here, but nothing works for me.
After some time I've found android.os.Debug.waitForDebugger(); in the begining of my Activity. I hope this answer sometimes help someone, because this question was first in Google, when I search for help.
Update
Use Intellij instead of Eclipse for Android development (far fewer IDE interface bugs) and then disregard the following altogether:
Two important rules I've found since the original post:
1) Get in the habit of waiting until Eclipse is finished build the workspace - the indicator shows up in the bottom left corner of Eclipse by default. WS build times can take minutes in a large project with multiple libs. Don't change anything until the build is complete.
2) Close all projects in the workspace and reopen them one-at-a-time starting with the project with no lib dependencies and so on. Make sure not to open a project until you can verify the the workspace has finished building what is already open. Fix any issues along the way before opening the next project.
Good luck.
Happens to me sometimes - have you uninstalled the application completely from the handset and tried to reinstall? Can you install the apk and then disconnect the handset from the machine? (obv won't work if you're using an emulator)
Faced same issue on Samsung S4 and issue is fixed by unchecking "Wait for debugger" option under "Developer options".
Had the same issue, check that you haven't got this line of code anywhere in your project:
android.os.Debug.waitForDebugger();
It may exist in a Service for debugging purposes, once you comment it out it will work in release mode. The problem is that this line of code waits for the debugger, and if you're not running in debug mode it will wait indefinitely

How to resolve "Waiting for Debugger" message?

I have HTC Comet connected to Eclipse with SDK 2.2. I do a debug build - the application does not run; though it does get installed on the device. On the device I get this message box on the Comet screen
Waiting for Debugger
Application HunyDew (process com.airvine.hunydew) is waiting for the debugger to attach.
[Force Close]
Whereas in the Eclipse console I get these set of messages
[2010-12-07 01:42:29 - hunydewprj] Android Launch!
[2010-12-07 01:42:29 - hunydewprj] adb is running normally.
[2010-12-07 01:42:29 - hunydewprj] Performing com.airvine.hunydew.HunyDewAAStartsHere activity launch
[2010-12-07 01:42:47 - hunydewprj] Application already deployed. No need to reinstall.
[2010-12-07 01:42:47 - hunydewprj] Starting activity com.airvine.hunydew.HunyDewAAStartsHere on device 308730C861BC
[2010-12-07 01:42:49 - hunydewprj] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.airvine.hunydew/.HunyDewAAStartsHere }
[2010-12-07 01:42:49 - hunydewprj] Attempting to connect debugger to 'com.airvine.hunydew' on port 8601
[2010-12-07 01:43:09 - hunydewprj] Launch error: Failed to connect to remote VM. Connection timed out.
The application runs fine in the Emulator - please help - what is it that I am missing here? Any hints/suggestions? Thanks
Some devices will only let the debugger attach if the application has the android.permission.SET_DEBUG_APP permission set in its manifest file:
<manifest>
<uses-permission android:name="android.permission.SET_DEBUG_APP"></uses-permission>
</manifest>
The Dialog Waiting for Debugger is shown if you are building a debug application or somewhere in your source code, you called Debug.waitingForDebugger();
Inside Android Studio 2.0 and above, there is an option of Attach Debugger to Android Process. It is the last menu item in the Run menu.
Not sure if this is what you are looking for, but try putting:
android:debuggable="true"
in the application tag in the AndroidManifest.xml
I've got this problem for long that I cant get my android emulator or device connect to the debugger while both the console and the emulator were displaying waiting for connecting to the debugger.
And configuration for debug inside eclipse also confused me so much before, but today, i got this problem solved, by the following steps:
When you want to debug a android project, for instance, mypro. you would right click on it in the "Package Explorer". Then choose "Debug as"-->"Android Application".
Then the emulator might stop at the "Waiting for connecting to debugger"(or something else similar to this).
Then you need to connect to the debugger yourself by click "DDMS" to open the DDMS perspective, and click "Devices" tab.
Then you can see a list of processes that are running on your emulator or device.
Double click on the one which you are debugging, then change to the Debug perspective, you can see the debugger is connected and you could debug your program. That's how I solved this problem.
By the way, my OS is Win7 32-bit. Eclipse's version is Helios Service Release 2. Android SDK is rev. 16 and platform-tools' 10.
Update.
I found that it is the problem of my TCP/IP configuration. The debugger can't be connected when i assign a static IP address(for access to internet).
So every time when the debugger is unable to connect, I always do the following steps:
1.close current eclipse window.
2.change the config of IP address to dynamic, it means getting a IP address by DHCP.
3.open up the eclipse again.
then the debugger is able to be connected. I thought it might be a issue of the internal mechanism of java debugger which is using socket connection.
I get this if I switch the usb cable to a difference port on my PC, odd but it works when I switch it back again. Also I think I've got this when there's been another device or emulator running at the same time, or two instances of Eclipse open.
For those getting this annoying behavior in 4.2.2 you have to un-check the setting for "wait for debugger" in the developer options. Of course, those options were hidden by Google, and you have to do a sneaky trick to get them to show back up. I had set them before they disappeared, and couldn't for the life of me find them again.
This page explains the procedure
Running Android Studio, I ran into this problem and after trying various remedies restarting Android Studio is what appeared to fix the problem.
My solution is to use the Dalvik Debug Monitor. Sometimes there is a red or green bug beside a process. Click on the device you're trying to load to. Select the Actions tab and reset adb. This usually attaches the debugger for me. I find that doing debugging through this Monitor works better for me than using the Android Eclipse plugin Logcat.
Closing the emulator and closing eclipse. Reopening Eclipse and starting the simulator worked for me.
The key thing to look for is in the Devices pane of Eclipse. If you start the emulator or device and it shows up in the device name list but says [null] and no running processes show beneath it, then it won't work correctly with loading your app into it.
If the name of the device comes up and is Online then things seem to work smoothly.
Don't know why it doesn't work out all the time though.
In my case, the problem is caused by adb connected with another device.
If several devices are connected in PC, remove other devices except required one.
I end up going into "Debug" perspective.
Then in the "Debug" frame, there are debug list or running list.
You have to decide which one is your current one that has this problem (Waiting
for debug...)
Then do right-click and choose "Terminate and Remove".
Then you try to run again. And that warning box will be gone.
I solved this issue this way:
Go to Run menu ====> click on Edit Configurations ====> Micellaneous and finaly uncheck the option Skip installation if APK has not changed
Rebooting the phone was the solution for me.
If your development environment is Windows make sure the USB drivers are correctly installed.
One way to ensure that the USB drivers are installed correctly is to get the PDANet Windows installer and let it install the USB drivers.
You can find the PDANet page here.
I would try to connect to the phone with ddms on its own without Eclipse. You might be running an emulator inside eclipse that you dont see or have some other problems with Eclipse.
Just run ddms from a command prompt and see if the device appears and you can connect to it.
You can also see if appears when you run adb devices and see that your phone is listed (and maybve something else..)
I got the same problem, I know I wasn't running any other instances, and I could see it with adb devices. I just did a restart of eclipse and it worked.
Rebooting the PC was the only thing that worked for me. It worked when I had this problem with an Android 2.2 phone, and also an Android 3.1 tablet.
I ran into this problem today. After spending most of the day trying to fix it, the only thing that ended up working was to create a new workspace and import my project into it. I hope this helps someone avoid all the trouble that I went through.
I also enounter this problem. In my environment, I use a tomcat as server and android as client. I found,
If tomcat is started, this error " Launch error: Failed to connect to remote VM. Connection timed out." will occur.
If tomcat is not run, adb works well.
I tried all the solutions above, it fixes the issue sometimes, but still from time to time I happened to get stuck with the "Waiting for the debugger to attach" message box.
The final solution in my case was to unplug all the Android devices but the one I want to debug on. I don't know which one is the culprit: the Nexus 7 running JB 4.2, the HTC One X running ICS, the HTC Desire S running Gingerbread, or the combintation of the 3, but as soon as I only have one device plugged in, it runs smooth as silk.
I used Task Manager to kill adb.exe to solve this problem. Adb.exe will automatically start after being killed.
Killing adb.exe has solved a lot of problems related to debug and emulators for me so far.
For Android Studio users I encountered this problem first time while trying to run a bare
bone project just after updating my jdk location. So I stumbled across this post. In my case simple Build->Clean Project did the job.
I was also having the same problem when using Android Studio and GenyMotion.
I am able to solve this problem by pausing the program and resuming it again after "Waiting for debugger" message is shown. It may work while using other IDEs and emulators as well.
Android Studio 1.2.2 on Mac OS 10.10
Same problem as others have reported.
I closed Android Studio, then checked from command line in terminal:
ps -efw|grep -i android
This reported a java process (.gradle/daemon) associated with Android Studio. I killed this process, restarted Android Studio, and the problem went away.
disable you developer option in your phone.
Settings > Developer option > Disable
This worked for me, when i tried to use my application without debugging it.
What solved the problem for me was going to:
"Run"->"Attach Debugger to Android process" and then select your process.
You do this in Android Studio.
I had the same issue, fixed it by explicitly selecting desired device in debug configuration. Unfortunately, even after that log sometimes stops when debugger tries to connect. In this case in DDMS perspective find the desired process. It will be highlighted with green bug. Click stop and then debug it again.
This may be old, but for Genymotion's latest update 2.7.1, go to Developer options, if in case you dont know how to open that option, go to About phone and click Build number few times and Developer options will be enabled. Turn ON Developer option, check USB debugging.
Tested on Genymotion 4.4 and up.
Weird solution eh ? But definitely works. Hope it helps.
Happy codings.
In Debug mode Android Studio connects to your Device via socket(:8600). Somehow your socket connection is choked and thus not responding to incoming connections.
Restart Android Studio and your problem will be resolved
"Wait for debugger"in Developer options may have been set to wait your application.Please clear that option and application should run normally.

Categories

Resources