Related
Typical output in Debugger view:
Waiting for device. Target device: unknown_1-stv100_4-1161305457
Uploading file local path:
/Users/homedir/devel6/avengers/packages/inputmethods/BlackBerryLatinIME/build/outputs/apk/My_APK_FILE-debug.apk
remote path: /data/local/tmp/MY_SERVICE No apk changes detected.
Skipping file upload, force stopping package instead. DEVICE SHELL
COMMAND: am force-stop MY_SERVICE Waiting for process: MY_SERVICE
Then in 90% of case it starts to spam view screen with message:
Client not ready yet.
I had a same problem.
After I just add below codes to onCreate(), the problem is resolved.
android.os.Debug.waitForDebugger();
After I use android studio, I removed above code. Because studio works well without above codes unlike eclipse.
But after update studio, I could not debug. It says like below
Waiting for process:
Client not ready yet.
Client not ready yet.
Client not ready yet.
It's not connected to the target VM.
For android studio select Run--->Attach debugger to android process that solves the problem.
It's sad to say, but I lost a lot of time in my battle with wind mills. The problem was in bad naming of packages. As soon as it was fixes, problem disappeared. I understand that it is my responsibility to fix such error. But it seems to me that Android Studio could provide a bit more diagnostics.
phone setting should set on MTP mode and nothing else. debugger connects to my phone after this change.
This problem occurs on some phones when debugging, probably because of some error logs are not printed out, but when I move to another phone can see the error。
like:
I do not have permission to add the following error message in less than one plus phone watch Client not ready yet..Waiting for process to come online
android.permission.INTERNET
but When I can see some errors when use nexus5.
This thing happen to me too, the problem was that i disable instant run, just enabling instant-run, fix the problem, check it
Go to:
File -> Settings ->Build,Execution,Deployment -> Instant Run
And Enable Instant Run
Should do the trick
Hi I have created a cordova plugin for Android. But it is not functioning properly.
I want to debug it an IDE.
How can I debug the cordova android plugin file when I launch the application in my mobile?
What are the different and easiest ways to do it?
Thanks in advance.
Expanding response of laughingpine, i use this method:
Debug javascript part with chrome + dev tools + genymotion. You can access it from "inspect devices" and you can debug javascript part.
The problem is for debug my own plugins. For this, i build project "cordova build" from console, and import into Android studio the content of platforms\android from project folders.
After repair some errors whit gradle, i can run and debug whit android studio + genymotion, to acces the .java files.
Build your Android app (via cordova build android) and install the app in your device. For instance, I installed Dropbox on computer and device and transferred the files between them with that free service.
Plug the device into the computer with your USB plug.
Set up the device to enable debugging. In device, Settings:
Allow USB Debugging
Select debug app
In console, type to following so we can read all the messages in full:
adb logcat -v long
If you want to output all the messages to a text file on your Mac desktop (it’s different for a PC), type:
adb logcat > ~/Desktop/logcat.txt
Immediately the console should be outputting a lot of lines of text. If it stops at
-waiting for device -
and freezes, then check your screen to see if there is a popup to answer. If there is none, then unplug the USB from the device and try again. In my Settings > Developer Options, I chose “Select debug app,” then chose the app I installed; that might help too.
When the reporting stops, sometimes I hit Return a few times to mark the place with a large gap of space before doing the next step. This tells me how far to back up.
Tap on app icon in device to start it.
Read the output in logcat.
Tap Ctrl+C to stop logcat.
I think the best way to do this would be with logcat. Logcat is also built into Android Studio, so you can use that IDE to help you debug.
If you are running logcat from the command line, you can limit to a certain tag using the following: adb logcat -s "YOURTAG"
If you are running via Android Studio, see this documentation.. You are able to attach the debugger to a running process, so if you didn't do up your application in Android Studio, you can still attach the Android studio debugger to it. This is done by selecting Attach debugger to Android proccess. Again see the documentation for more.
Android Studio also can also filter based on tag name, log type, etc. This is done by expanding the filters menu, and adding a filter (filter by type, tagname, regex are accepted.)
Lastly, actually getting your plugin to spit out valuable information. First import the Log class: import android.util.Log; and setup a TAG private static final String TAG = "MYTAGNAME". Whenever you wish to write to the log (in this example, the debug level), call Log.d(TAG, "Your message to debug");
See the log documentation for more.
Personally I was right at home using logcat from the command line, but Android Studio does offer a slick interface for debugging your plugins.
Ok.
So while this isnt a programming question.
I wanted to know how do people debug apps?
How do you view log cat, and where these exceptions are thrown etc?
And do I need to run the app on the emulator to see all the stuff, or is there a way to view this after running the app on my phone(while not being connected to the computer)
Links to plugins and tips would be really helpful, as im gonna start work on my next game, and while the first one works fine, had a lot of problems while debugging.
Setup: download the Android Developer Tools (ADT) plugin for Eclipse from here http://developer.android.com/tools/index.html
To debug:
Connect your phone to PC via USB
Open Eclipse, set breakpoints
wherever you need
Run -> Debug to relaunch your app in debug mode
Use the Debug perspective, see:
http://developer.android.com/tools/debugging/debugging-projects.html
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.
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.