On every runtime error in AIDE (when the application crashes) the logcat window is displaying all messages again (even from the last days) which needs long time to scroll to the end to find out what's wrong. I don't want always clear the logcat list before i compile the project, but i did not find any setting to avoid this behavior. Does anyone have a solution for this?
Actually you can have command line,use
Terminal IDE if your device is running on android 4.x
or lower,
Termux if Lollipop+,
launch your app within one of these Terminal Emulators with am command:
am start -a android.intent.action.Main -n com.your.package/.Ur_Main_Activity
And then use the logcat command to observe log, it will be a bit cumbersome though, use filters as you see fit. Enter ctrl+C to end Logcat dump. Hope this helps,
Related
I met a weird issue when I tried to search some logs during emulator booting.
When I create an emulator, the adb device started with "offline" first, then I type
adb logcat -v time | tee log1.txt
and adb will keep "wait-for-device" until the adb became online.
Then when the emulator boots up, I type adb logcat -v time | tee log2.txt again except the destination of the log file.
Now, I use vimdiff log1.txt log2.txt to compare these two logs and found log1 missed many logs as Log_Diff
I have no idea why some logs in log1.txt will missed.
Any ideas?
P.S. I am using Android 5.1-64bit Emulator in sdk.
After some research, finally I found the root cause in Android log daemon.
The main problem is the LogBufferElement is using a CLOCK_MONOTONIC timestamp as the sorting index.
When the timestamp of the multiple LogBufferElement are the same, LogReader may only dump the last entry. That's why some logs seem being lost.
AOSP Android 5.1 still had this issue, but Android 6.0 had fixed it.
You can refer to this patch.
Btw, I also did some modification for this patch.
The main reason is Android 6.0 supports the C++ 11 atomic std libs, but Android 5.1 is not yet. Some the atomic APIs need to roll back. (e.g. atomic_fetch_add_explicit())
the other day i was editing a layout when suddendly eclipse freeze for a long time and when it came back I couldn't run the application nor edit the layout anymore. I reboot my PC and I was able again to run the app but the LogCat doesn't work anymore.
This are some screens:
Can somebody tell me what is happening ?
Open CMD and write adb -d logcat <your package name>:<log level> *:S. If you don't get any logs maybe your Android SDK is somehow broken or damaged and try reinstalling it.
Is there some way of having the logcat window not being always on top?
I seldom have a use of such windows, and I cannot find a reason logcat would be an exception.
Try to minimize the Eclipse and drag logcat outside the Eclipse
There's no requirement that you run logcat through eclipse at all - you can run adb logcat from the command line shell of your host operating system. This also allows you to capture the output, make interesting filters with grep and so on.
The location of the adb executable has changed in different releases of the android tools; currently it's in the platform-tools/ directory of the installation, so if that is not in your path you will have to explicitly specify the location.
I'm running the command
logcat -d AndroidRuntime:E *:S
When ran from adb on my computer, it displays all the things it should. When I try to run it from an Android application with
Runtime.getRuntime().exec("logcat -d AndroidRuntime:E *:S");
and print the output, it won't display anything except the headers.
How can I fix this?
First, this has never been supported.
Second, if you are running on Android 4.1 and later, you will only get any log messages that your own app logs, not messages from other apps, as you can no longer hold the READ_LOGS permission in an ordinary SDK app.
I get an error in the android emulator. "The application AppName has stopped unexpectedly. Please try again.
How do I use the debugger to troubleshoot where the error occurs
This is a pretty big question. Here is the standard Android documentation for debugging android apps:
http://developer.android.com/guide/developing/debugging/index.html
I don't usually answer with a link.. but honestly this it's probably easiest just to go through the piece of the URL. breakpoints and log events.
http://www.vogella.de/articles/EclipseDebugging/article.html#usedebug_breakpoints
you should also look at the log file. By default android logs all messages to a log file which you can access on your command line as "adb logcat". For more on adb tool loot at here
I am not sure what kind of debugger you want. AFAIK, two debugger can be used in android: ADB and gdbserver. If you want debug java code, you can use ADB. You can issue "adb connect localhost" in shell to make adb connect to your emulator. Then you can use "adb logcat" to see the log of your emulator. Mostly, the emulator will give you log about where the error occurs in your java code.
I just recompiled after waiting a longgggg while without changing code (I did remove code and a xml file, but undid it with cntl+z) and then it worked without issues - sigh –
I like to use Logcat. Logcat will give you a pretty detailed error message with the lines that the error occurred on. You can open up the Logcat perspective in Eclipse by going:
Window -> Show View -> Other (if Logcat doesn't show in the list) -> Logcat
I prefer this to the debugger because the emulator runs a bit faster.