5

I regularly obtain the infamously unhelpful "unfortunately crappyApp has stopped working". How to figure out what actually went wrong? I guess there's a stack trace somewhere, though ideally I'd like to modify the unhelpful message itself if that is possible on a rooted device.

2

There are multiple ways to obtain useful information. But as Dan pointed out, on-device solutions will require root (starting with JellyBean) – and off-device solutions ADB:

  • adb logcat was already described in Dan's answer. For more details, you can see our tag-wiki.
  • adb bugreport > report.txt gives very detailed information, including details from the dumpsys, dumpstate, and logcat tools. Several tools for easier analysis of its output can be found e.g. in the answers to Better method of viewing “adb bugreport” output? on our sister-site.
  • there are tools to be installed on your computer which utilize the above (or at least parts of it), like QtADB (for Linux, Mac, and Windows)
  • there are Android apps like Bug Reporter; but as pointed out, most of them will require root. Bug Report Reader however claims to read system logs (logcat, dumpsys, dmesg, top and much more) on your device, without root, so that might be worth trying.
1

In most cases, if USB debugging is turned on, you can use adb logcat to see the exception output. This usually includes a stack trace, but that's not often useful unless you have the app's source code. All the same, the developer of the app will probably be grateful if you include it in any bug report.

  • 1
    Thanks, I'd prefer a native solution directly on the device if possible. good point about the usefulness, doesn't the trace at least include sensibly named java exceptions? or does dalvik obfuscate them? – Tobias Kienzler Oct 31 '14 at 15:42
  • There are apps to read the log from the device (search Google Play for logcat), but in Jelly Bean and later, apps can't read each other's logs, so you might need to root your device to do this. The trace includes Java exception names, but NullPointerException doesn't really tell you a lot unless you're the app developer. – Dan Hulme Oct 31 '14 at 16:29
  • 1
    good point about that exception :/ since I rooted my device anyway, I was hoping for a more comfortable way than logcat, though that's better than nothing... – Tobias Kienzler Oct 31 '14 at 18:10
0

Read the files under /data/anr/ which stands for "apps not responding". I use adb shell cat /data/anr/$FILE

There will be one for every app which force closes, or is not responding for some reason.

  • 1
    When looking at /data/anr/ in a root file explorer, there's only a single traces.txt which was modified three days ago (even though an app crashed today), and it appears to contain only system crashes, not app crashes. Is there another way too see those app backtraces? – oliver Nov 10 '16 at 22:10
0

You can simply see the crash stack trace after any crash happens. Use ADB command below,

adb logcat -b crash #default
adb -d logcat -b crash #show from device when multiple device
adb -s logcat -b crash #show from simulator when multiple device
New contributor
Sazzad Hissain Khan is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.