I am in a process of developing an Android app ... Therefore I have tested everything on my 3 android phones and everything was fine... I asked some friends to play with the app and app crushes...
I tried to use LogCat to receive errors on Galaxy S4 but it is impossible because log list is flooded by:
AbsListView D unregisterIRListner() is called
This happens every 0.1 second... All apps (expect CatLog 1.4.4) ... I've tried already resetting the phone, clearing apps cache, ...
Any idea?
Interesting. Can you see which app spawns the console. Anyway, for your problem. You can add filters to LogCat, thus only showing the information of your app. So for example you can use the TAG to filter your messages:
private static final String TAG = "MyActivity";
Log.v(TAG, "index=" + i);
And then use this command to filter:
adb logcat -s MyActivity
Its much easier to do this in an IDE. ;) You can find much more information on using logcat especially with console command here.
For this kind of situations, i recommend ACRA - automatic crash reporting library. It is very easy to configure.
How it works? Everytime your app crashes, it automatically sends stacktrace along with tons of other information to GoogleDoc form. Very useful tool, when you give your application to testers. It can even be configured to show dialog asking user if he wants to send crash log, and write some comment on what he was doing when app crashed...
Related
I've searched for similar problems, but I didn't find anything useful - I'm working with eclipse, and I can't see my Logs.
The device is connected properly, the app runs and does what it's supposed to do, but I get no logs from it.
I get other logs messages from the device, not the ones that I print, e.g. Log.d("SMS", "hello"). On the other hand, if I use the statement System.out.println("hello"), I do see it, tagged as System.out.
I've tried to disconnect and reconnect the device, restart it, close and open eclipse, choose the device from Device window. It happens both with a 'real' device and an emulator. I've also tried to remove the filtering, but nothing helps - I still don't get the logs.
Okay, I've found the problem -
Apprently there are some illegal tags, and I've used one of them.
My app is spam SMS blocker, and I've used the tag SMS. If I change it to another tag (like SMSBlocker) it suddenly appears in the LogCat.
Check if your project is using proguard.
Basically proguard will remove all the debug logs and optimize your code while creating apk.
Try adding proguard.enabled=false in your project.properties
I think you should use TAG.
When you log from your android app, the first parameter is a TAG string. So if you set it up to a unique string (like your app name) then you can later filter by it in Eclipse.
Example : Log.e(TAG, "state error");
When I connect my galaxy s3 mini via ADB and try debug application with android studio I get endless error/warning messages in logcat, non-stop messages goes like crazy. Is that normal? Usually with emulator I don't get tons of message in logcat. How can I fix this problem? here's how logcat looks like http://pastebin.com/JaVhYaCt or http://i.imgur.com/aaavMZm.png?1
By the way: I still able to test applications.
Is that normal?
Yes - the system itself as well as every app uses logging and that's what you're seeing. A bare-bones emulator won't have many apps with receivers and services running so you won't see the same amount of logging.
How can I fix this problem?
You can't as such but you can reduce it by force closing various apps from "Settings" on the device. Not necessarily a good idea but it's your choice.
You can improve things by using package TAGs in your code and then applying a filter to only show logcat data with your TAGs.
Example...
package com.mycompany.mypackage
public class MyActivity extends Activity {
protected final String TAG = getClass().getName();
}
In the above TAG will be "com.mycompany.mypackage.MyActivity". Use protected as the modifier so any classes which extend MyActivity will automatically assign their own class name to TAG.
When logging you just use `Log.d(TAG, "Some text");
You then just need to filter on "com.mycompany.mypackage" to only see logging from your own app components.
Simplest answer is that is normal to see all this verbose logging (the logcat contains info from everything on the phone, so can get quite verbose).
You can filter what is shown in logcat by using filters. If using the command line, it might look something like this (don't forget the end S:* - which indicates to 'Silence' everything. A simple tag filter from command line might look like this (show only messages with tags SHOWTAG1, and SHOWTAG2:
adb logcat SHOWTAG1:* SHOWTAG2:* S:*
The eclipse tooling (and maybe Android Studio, not sure) also has a Logcat viewer, which allows you to apply tags to filter by, or otherwise, use Regex or other filtering mechanisms to modify what is shown.
Bottom line, Logcat is verbose, you will need to filter it specifically to see what you want.
I am developing an android app. My app gets crashed often. I want to save the logcat messages in sd card while the apps gets crashed to find the root cause. Is ther any way to do this?
A few ideas which might help you step toward fully automated crash log gathering. We have yet to roll a full system here, we've had enough luck with just grabbing devices after they've crashed or asking for more info from our QA group, but:
ACRA is relatively easy to implement, and even if you don't implement it, the source is on github for you to poke around in.
The related question Android crash reporting library (pre Froyo) has a number of links and solutions, including android-remote-stacktrace, the aforementioned ACRA, Android-Error-Reporter, and other commercial solutions.
Some devices capture the crash output automatically, you can grab it via adb pull /data/log/dumpstate_app_native.txt.gz or similar -- the paths should appear in logcat. These tend to be overwritten with each crash, though. (If anyone can answer whether this is a manufacturer-specific feature or something that appeared in some version of android's core, I'd love to know!)
You can get a logcat app, e.g. aLogCat or many others, that you can install on your device.
TestFlight is going into beta on Android side; they have crash reporting on the iOS side and should on the Android side too, and there are various other lovely benefits to using their services -- and integration is really easy in our experience.
If you're rolling your own inside your app, you need the READ_LOGS and WRITE_EXTERNAL_STORAGE manifest permissions (even for local builds), then you can use the logging API or a regular File.copy or even a system call off to logcat itself. There are a bunch of options and examples in the "Related" links to the side of this question:
Stream android logcat output to an sd card
How to redirect my log output from logcat to the SD-Card on an android device?
...and so on.
Hopefully this helped.
Reading your own logcat messages is covered by other questions.
how can i access logcat file on device
Read logcat programmatically within application
In order to do this when your app crashes you need to install an defaultUncaughtExceptionHandler.
Either on your activity on create or your application on create. Add the following code.
final Thread.UncaughtExceptionHandler oldUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
#Override
public void uncaughtException(Thread thread, Throwable throwable) {
// DO your error handling here.
// Write your log cat, or write your exception stack trace here.
// Get rid of this line if you don't want a popup letting you know that your app has crashed.
oldUncaughtExceptionHandler.uncaughtException(thread,throwable);
}
});
I have an android application that I have recently finished. So I have successfully finished each function and ensured that no errors are encountered.
When I have exported it to an apk file. It runs smoothly. It uses httpRequests to communicate with a remote mySQL server. But there are times that it spontaneously crashes?
For example, I have an activity that would receive input from the user then communicate with the server. It runs smoothly and quickly. But on next run it would crash. And when I restart the application it would run smoothly again even on the second run. I'm just going crazy from this. Are there any explanations for these?
Use ACRA to collect crash reports from your app. You don't need your own server, just a Google Docs form. The integration is described here:
https://github.com/ACRA/acra/wiki/BasicSetup#wiki-Setting-up_your_project
The advantage of using a crash report tool vs. logcat is that you don't need physical access to the device. There are also chances that you see crashes that you or your testers didn't even notice.
The first step to debugging your problem is to get a stack trace. If you can reproduce this on your own device, then right after you see a crash, connect it to your dev pc and run this command:
adb logcat > crash.log
Open the log file, copy and paste its contents on http://pastebin.com/ or similar and add the link to your question. Once we have that, we can try to figure out what's going on.
I'm developing an android application using eclipse (ADT).
I've been doing it for a few months now, but suddenly today, when I start the emulator, it's over logging the logcat with this message:
Level: D
Application: system_process
Tag: ThrottleService
Text: deleteing /data/system/throttle/407640534
I searched and could not find a single thing regarding anything similar to this problem, it is impossible to use the logging system like this since it prints the same message more than 10 times per second.
I can of course use filters, but sometimes you want to watch all of the logs.
Any idea what this message is about and why it's being logged so often?
Thanks a lot.
Try a hard reset of the emulator. Instructions are here.