LogCat in Android Studio is showing me only the logs from about a day ago, while "adb logcat" command and DDMS LogCat window, works ok!
What I have tried: removed just about anything android related (except projects) and reinstall everything.
I cannot believe it. The solution to this problem was to reboot my phone.
Related
I have been using Android Studio for years but now all of a sudden the logcat messages are not displayed anymore in the logcat window of Android Studio as you can see in the screenshot. I use the following code:
Log.e("Log_AvIn:", "CategoryToBeDisplayed: " + ingredientCategoryToBeDisplayed);
However, in the "Run" window you can still see the logcat messages
I tried (almost) everything from this old post (Android studio logcat nothing to show) like restarting Android Studio, Using another Emulator, Invalidating the Caches, Restarting Logcat, Change the log level to Debug (or anything else) and back to Verbose, running adb kill-server && adb start-server in the terminal (I get an error when trying to execute this), launch ddms on the command line (I get an error when tying to execute this).
Does anyone have any further idea what I can do? As said before, it just happened recently. Before everything had been good for years.
If my Eclipse works for over 3 or 4 hours, and I want to debug my Android app after that time, Logcat literlly dies. Only when I restart my Eclipse LogCat reborns.
I have searched but it doesn't seem that I found any solutions to these.
Any ideas?
Thanks in advance.
Yes, it's a known problem which time to time could appears in Eclipse. My investigation lead me to suggestion that a problem could be in synchronization of ADB with IDE Eclipse. Mostly was helpful a restart of ADB.
1) go to command line (console mode)
2) change dir to ...sdk\platform-tools
3) type "adb kill-server" in command prompt and execute
4) type "adb start-server" in command prompt and execute
Then check the LogCat, most likely you will see that logs running again
The last way to resolve it - just restart an Eclipse, but this way is not comfortable
It happens to my Eclipse or Android Studio too, so what I do is I just write these two lines in onCreate method of MainActivity (activity which filter's Launcher intent)
Button button = null;
button.setText("");
this crashes my app and logcat shows crash log, then I comment out these two lines and logcat keeps working on normally. I would not restart Eclipse as it would take more time.
Restart Android Studio (realizing the question asks specifically about an Eclipse issue).
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.
The Console and LogCat printouts stopped working in Eclipse with the Android Emulator.
I'm getting the following Exception in the Console
[2011-11-10 11:04:58 - Unexpected error while launching logcat. Try reselecting the device.]device not found
com.android.ddmlib.AdbCommandRejectedException: device not found
at com.android.ddmlib.AdbHelper.setDevice(AdbHelper.java:736)
at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:373)
at com.android.ddmlib.Device.executeShellCommand(Device.java:319)
at com.android.ddmuilib.logcat.LogCatReceiver$1.run(LogCatReceiver.java:100)
at java.lang.Thread.run(Unknown Source)
Usually when the emulator is loading or updating an apk there's a printout in the Console telling the status. Now the Console is just blank.
I made sure the emulator is selected in the DDMS Tab.
I tried deleting and recreating the emulator in the AVD Manager. I restarted eclipse and the computer. I also updated all of the android and eclipse software in hope that the problem may get fixed. But, to no avail.
It may be related to a problem I had in my code yesterday. There was an unending loop in my code, so I had to stop the emulator mid code running.
I was having a similar error and it was driving me crazy. I just got it to work by doing the following steps:
In a shell or command prompt run: adb kill-server
Unplug the USB cable from the device and plug it back in.
Open the devices view (Window -> Show View -> Other -> Android -> Devices)
Click on the device on the android devices view.
I tested this for the emulator and it works if you relaunch the emulator instead of step 2.
Another way I got it to work was to restart Eclipse. But that's not usually ideal.
Note: Logcat would stop working any time I disconnected the usb cable from my android device (similar to killing an emulator).
I recognize this might not fix your initial issue, but it might help others who stumble on this question.
I also had the same problem, install the SDK even three times as TT, but the solution is to go to the folder android-sdk-windows, then platform-tools, and double click adb and ready!
Clean project with Project/Clean...
deleting the emulator and creating a new one did the job for me.
Even in my case a faulty code or a secret infinite loop, i think is the problem. i tried out something and logcat failed to boot up since then.
Most likely you have 2 instances of Eclipse running (I did).
(On Windows) Exit eclipse then check with the Task Manager if there is another eclipse.
End it as well as any image name "adb".
I'm trying to run helloandroid application on a Motorola Milestone A853. I typed "adb devices" and the mobile is properly recognized. However, when I try to run the application Eclipse always stuck at 27% "Launching delegate".
Which could be the reason?
Had the same 27% problem with an emulator. It only got fixed after I deleted the AVD and recreated it, so this is very likely device/emulator related (and furthermore restarting the ADB did not fix the problem).
EDIT:
Found this over at project pages as Issue #21073, answered by benpar:
Update: This scenario can also be avoided if the AVD emulator is launched from the AVD Manager within Eclipse. The issue happens when launching the first emulator from the Run button in Eclipse.
To avoid:
Start Eclipse
Window -> AVD Manager
Start an emulator
Run the project
I also had this problem when running an application in the emulator. Make sure the emulator is running BEFORE launching the app and you wont have this issue.
To get further information, try installing and launching the application from the command line outside of Eclipse. You'll find your .apk in the /bin folder of your project, then use:
adb install -r <projectname>.apk
It may work and if not, you may get better information about the cause of the error. My experience with Eclipse has shown that it can be finicky at times and this should help you isolate the issue.
I had the same stuck at 27% problem. Unplugging the device and plugging it back in fixed it.
I've found that the quickest way is to check with the Android Debug Bridge on the command line. Sometimes all it takes is stopping and starting the adb server. That is:
adb kill-server
Will stop the server. Then:
adb start-server
That should do it. Check the attached devices ( but it's not necessary )
adb devices
and it lists the devices attached.
Then go back to eclipse and start debugging again.
This can also be done in the Devices view through Eclipse.
I got the solution of this problem bit silly one. What i did was started emulator from one instance of eclipse.. Closed eclipse. Closing eclipse wont stop the emulator. Now re-launch eclipse. Now run your application in the emulator already running.
Very annoying problem. I was having to close down eclipse and the emulator and then start up again which became time consuming. Came here and read what Anna Lear and Vinay posted. Worked! I think in my case this problem happened because I exited eclipse while the emulator was still running. To correct, as Anna and Vinay posted, do this...
Make sure eclipse and emulator are shut down, then...
start elipse
start emulator
quit eclipse (do not quit the emulator)
start eclipse
now run your program (should load 100% and not get stuck)
For me it was the ADB which had hung. No amount of quitting either eclipse or the emulator had any effect.
Terminate the emulator
Terminate the ADB, (I simply killed its process using task manager.
Start the emulator again, (also causes the ADB to restart)
Run your program
It should no longer get stuck.
I was using Samsung Galaxy to run the app. I wasted a lot of time in running app but it was not launching and i had to restart eclipse every time.
For me, i just follow these steps and there was no problem any more
removed my device from my PC
Run the app
When it asks for attach your device or create AVD.
I reconnect my device and select for output.
Finally i resolved the issue