I am using Android Studio v1.3.1 and when I am running a project on real device, I have to wait couple minutes till actual logs comes up in log console using Verbose & Show only selected application. If I choose No filtres it shows me older logs coming up, like 2-5 mins again. After all old logs are showed in console, it comes the news ones... I tried to restart logs, but it begins again to show old and then actual.
Any suggestions?
This issue(port issue) sometime happens if logcat does not clear the recent output caches on plugged devices.
AndroidStudio Solution (Clear all outputs and device ports)
Plug-Out your devices or close any emulators
File > Invalidate Caches / Restart > Press "Just Restart"
Also it's recommended to run any project with fully cleared logcat.
Run > Edit Configurations > Tab(Logcat) > CheckBox(Clear log before launch)
I personally would always log through terminal.
Terminal Solution
Just check if your device is plugged
path/to/android_sdk/platform-tools/./adb devices
Log your devices
path/to/android_sdk/platform-tools/./adb logcat
To get all logcat terminal options, see link below:
http://developer.android.com/tools/help/logcat.html
The entire log file is stored into the device storage, it can be extracted to the system so you can see the previous logs from the file.
Connect your device and run the command in terminal.
adb logcat -d > logcat.txt
Related
I'm very new to Android Studio. I have been using it on Windows but the machine was too old to run any of the emulators so I installed it (via Ubuntu Software store) on a laptop running Unbuntu 18.04.
It all seems to work OK except the Logcat does not show anything. Sometimes, after cold starting the emulator, I get some output to the Logcat but then it just halts and nothing I do (see below) causes it to output anything else.
I cannot get ANY output when running an app.
I have searched extensively here and via Google and tried the following:
restarted the Studio
restarted logcat
killed and restarted adb
invalidate caches and restart AS
deleting and recreating AVDs
use logcat via AS built in terminal and external shell :
./adb -s emulator-5554 logcat
and get:
Unable to open log device '/dev/log/main': No such file or directory
NB: When using an attached phone e.g. Moto G. the logcat works fine. I get all the system output and the app output works as expected.
Thanks in advance
2019-12-14 UPDATE: when the emulator is running it shows the active processes (see screenshot) in the drop down, including my app but NO entries. Not sure if this gives anyone a clue? It is clearly communicating with the emulator in some way.
2019-12-16 UPDATE: Started in from scratch. Installed MX Linux 19 and fresh Studio install. Created new AVD. EXACTLY THE SAME!!! This is so ridiculous. Anyone, please?
sometimes you might be trying to use a gun to kill a fly. For a try, ensure that the emulator you have run is actually selected in logcat like in this screen shot
.
I recently updated my Nexus 9 Tablet to Android 7 Nougat.
Since then the Logcat view in Eclipse stoped displaying Logcat messages, the view just stays empty.
Also the devices target is shown as "Unknown".
If I instead start Logcat outside Eclipse (AndroidSDK->tools->ddms) it displays all messages. However, then the "Application" Column stays empty.
There are allready some (older) questions on this topic here on SO, but none of the solutions here worked for me.
What i tryed:
Use another USB Port
Focus the device in the DDMS perspective
Restart Eclipse
Reboot the device + pc
abd kill-server
disable and re-enabled USB Debuging on the device
Reset the USB-Debuging authorization and confirm the RSA fingerprint again
Switch USB-Mode to "MTP"
Every installed package from the Android SDK is up to date and i use latest Eclipse+ADT Plugin.
Also everything works fine with my Galaxy S5 Mini (Android 5.1.1).
I know, that the ADT-Plugin is deprecated and we should use Android Studio.
However I still preffer to use Eclipse as long as possible, so I am looking for a solution for this problem.
So does anyone know how to solve this issue?
I tried with this custom build and it works for me. Now I can see my logcat in Eclipse again.
https://github.com/khaledev/ADT/releases
Download the zip file then in Eclipse menu Help > Install New Software... > Add > Archive...
Just pick the downloaded zip and do the rest of the install process.
can use "Android Device Monitor" Application,
This application in the sdk-tools package.
Launch From the command line,
cd to the "sdk-tools folder/tools/" directory,
enter the following command : monitor.
or
windows environment,
open the directory "sdk-tools folder/tools/",
and double click monitor.bat.
detail -> Google User Guide
I had the same problem. Eventually, I found out that the "Eclipse IDE for Android Developers" was out of date. Updating this feature fixed the problem. Procedure:
Open Help -> About Eclipse -> Installation Details
Select "Installed Software" tab
Select "Eclipse IDE for Android Developers"
Click "Update" in the bottom.
Try to launch directly sdk tool monitor from Android SDK, it can be found in:
sdk-tools folder/tools/
you'll see monitor.bat, click on it to launch Android Device Monitor oustside Eclipse, don't forget to create a filter for your APP, go to logcat window-> Saved filters -> + -> fill your app name in "by Aplication Name"
If nothing works, in an emergency, you may try this to get logcat over command line (use cmd in windows), type :
adb logcat --pid=YOUR_APP_PID_NUMER
this shows messages from your APP. if you don't know your PID, put a line in your APP code:
System.out.println("foo stuff I can find easily when I read logcat results");
Run your app, make sure you get the up line executed.
Then in your command line type:
adb -d logcat System.out:I *:S
Find your line System.out.println("foo... and read the PID number, is next right to time data.
And then
adb logcat --pid=pid number you read from your comment line
to get logcat messages from your app in the command shell in real-time.
If you just want messages output till now, just add -d modifier:
adb -d logcat --pid=pid number you read from your comment line
Whenever I run my app from within Android Studio, the ADB output is automatically shown in a tool window e.g.:
Waiting for device.
Target device: asus-nexus_7
Uploading file
local path: C:\Development\AndroidStudioProjects\example\main\build\apk\main-debug-unaligned.apk
remote path: /data/local/tmp/com.example.app
Installing com.example.app
I almost never need to actually read this output, but I can't find a way to prevent it from showing. If I edit the run configuration, I can prevent logcat from opening automatically, but not the ADB output.
Is this possible?
Thanks
So, the logcat one can be solved by editing your run configurations.
From Run > Edit Configurations, select your Android run configuration from the menu on the left, and switch to the logcat tab. Uncheck the "Show logcat automatically" box and hit apply.
Then you'll have to deal with the issue of hiding the "Run" tool window, of which the only workaround I know is to resize it until it's not visible.
It failed 3 times in a row! What can be the reason for that? I made significant changes to the project since the last run (which succeeded), so can it be something in my code that makes it crash?
Thanks.
Please post any other errors that are relevant.
Here are some things to try:
Shut down and restart adb:
Open command prompt (Start > Run > cmd)
Type adb kill-server and then hit enter
Type adb devices and then hit enter
Clean and rebuild your project completely. If you are using Eclipse:
Click the Project menu at the top, go to Clean
Select your project, then click OK
I'm sure you have done this, but also try restarting your IDE.
This may sound stupid, but make sure your AVD IS running (and not locked up).
I am trying to debug my android application using log messages. When I use System.out.println and Log.i and run the android application,I cannot see the debug message in either console or Logcat. If I have to get the debug messages do I have to run the android app in debug mode
from eclipse goto window -> open perspective -> other -> select DDMS.
And then run your app. And then select your running device from DDMS.
If it is not resolved your problem, restart your eclipse without closing your emulator and then flow the same above steps.
Njoy,
You do not need to run your app in debug mode to see log messages.
In order to see the log messages, you only need to have usb debugging enabled on your phone, the adb drivers for your device installed, and a copy of the android developer tools. It sounds like you have the above things, so I will suggest some steps for troubleshooting this.
Don't use System.out.println, because it does not allow you to specify a tag. Make sure that you set a good tag for your log messages. Once all of the above is confirmed, attempt to view the log message in eclipse's logcat view. Create a filter with the tag you are using because many messages will print and it may be difficult to find yours. You can also filter by application by using the name of your application's package.
If you have tried all this and you still can't see log messages, try running:
adb kill-server
and
adb start-server
If no luck, try restarting eclipse.
Confirm your device is plugged in!
If none of this is working, you can also run ddms from the sdk tools which is a bit more reliable.
Finally if that doesn't work, you can simply issue an adb logcat on the command line. If you have multiple devices, you can list them with adb devices and resolve the device or emulator with -d for the only connected device, -e for the emulator, or -s serialno to resolve otherwise.
There are also tools that will allow you to view the logs on your device, such as alogcat
sometime you may not select the emulator
and another way is to
restart your eclipse i also have faced this problem many times
If you're using Eclipse make sure that:
You have Debugging enabled in your device (or that you use emulator),
Your device is connected properly - it should show up in the Devices view. If you don't have this view get it from Window->Show View->Devices,
You've SELECTED your device in the Device View (simply click on it),
You don't have the LogCat paused and no filter is enabled - All messages (no filters).