Android: How to find out reason for "Unfortunately [...] has stopped"? - android

when I run my Android application with an emulator, it works perfectly, and so it does on my phone, but on another phone, trying to run the app, I always get the "Unfortunately [...] has stopped" error. How can I find out the reason for this error (Using the emulator, I could look it up in LogCat, but not on a real phone)??
Thanks in advance!

On a real phone, you can use the tool aLogCat to view logs on the device itself. You can also connect it to your computer via USB and use the adb logcat tool, and the logs will be visible from the computer's shell window.
Adb logcat could also be used over a wireless network with a tool like WiFi ADB, should you prefer wireless methods.

Android Remote Stacktrace is a quite useful library/script that allows you to easily add a way for a phone to send its crash logs your way.
Simplest would in this case probably be to add it to a test version you put on the other phone. Since it's not being actively developed (afaik), you may not want to put it in a normal store release build.

Related

Is it possible to see output from log cat without having the app source code?

I have an app installed on my device.
An app that I developed, but I haven't got the source code anymore.
Is it possible to attach log cat to this app?
yes you can, just enable usb debugging on your android device, and plug the device where you have the application installed on it, by that, you will see all the logs on logcat.
Depends if you've left logs in the code. If you did, the easiest method would be probably going into your Android Studio and checking you Android Monitor tab. You can switch devices / applications there.
If you don't have any logs and your question actually means you want to add some logs in, then I'm afraid you can't reliably do that.

Get LogCat From Android Device Manually

My phone cannot connect to the android ADB but I need to check its logs since it seems to be getting unique errors from an app I made. aLogcat app is outdated and getting "bug reports" from developer options is unreadable for me.
Is there any way for me to get a logcat report of my app while I'm running an application on it?
Edit: I use a droid Mini phone and it won't connect to eclipse. After installing the specific driver for the device it worked.
First of all, consider making ADB work for your device. Provided this is totally impossible, consider using ACRA. If you don't want to integrate fully with it, check their logcat collection code.

Debugging Android Apps without USB or root

I'm currently developing a small android app which communicates with a FTDI chip over USB so I can't use logcat to get the logs live. Unfortunatly the Android device is a Galaxy Tab 2 with Android 4.1.2 which I'm not allowed to root. That means adb-wireless won't work too. And because it's just a small app setting up a bugtracker system like ACRA seems a bit oversized.
Is there another way to get the logs of my app?
Many thanks
I can't think of any "live" logcat output, but you can view your Logcat Output (which is Buffered) via adb logcat. Test the things in your app you want to do or to get the Error you try to solve, then connect the USB to a Computer running adb and dump the Log.
More information for the logcat Command can be found here
You can make a utility function that opens an HTTP connection and writes to a web server.
This adds a little overhead to your application, but works fine to get log info.
Easy to implement, no rooting required!
Or you could write a little service that runs a web server that responds to requests with a dump on logcat (or a tail or logcat or something).
It might even be possible to write a shell script that uses curl or wget to do this (that is send get requests to a webserver in order to pass logcat output), but you might need to install them, which in turn you might need root for, so... maybe this wouldn't meet your needs.
I guess it might even be possible to create a network share on your workstation, mount it on your android device and just redirect logcat output to a file on the share. But I didn't try it - let me know if you do!
You could use apps like Logcat or others alike, which will give you the same output as your IDE Logcat console.
You can turn on the logging, do your stuff in your app, and return to the logcat app to check out the log, mail it to yourself etc.
I did a little bit more research and it seems that there's no possibility to read the logs easily without having root rights. You're able to read the logcat output using bugtracking libraries like ACRA in your Android app, but it's a lot more effort to include them and analyze the logs.
I'm going to develop on my own (rooted) tablet with adb-wireless now.

how to enable logcat in eclipse when the project running in external device in android?

Im using an application in android. I want to enable logcat in eclipse when the project running in external device. Im trying to load the application when USB Cable is mounted to system. But Im not able to saw anything in logcat and cant acess the device view also. If anyone know about this please help me..
Add the devices view and then select the device there and you should be able to see the log.
I am sure more than 1 devices are attached to your PC, among that 1 may be an emulator and other may be real devices(i.e. either mobile or tablet).
So whenever you are having multiple devices, at that time first check the devices attached to your system by using adb devices command at command prompt.
Once you are having serialnumber, you need to run the below command:
Solution: $ adb -s <serialnumber> logcat
PS:
If you just use adb logcat while having multiple devices attached your PC, then below message are being continuously raised:
error: more than one device and emulator
- waiting for device -
It should work with no problem (I did nothing and works)
Maybe you're using a filter of another application.
On the left column (in LogCat view), choose to see "All messages" or create a filter of your own for that application.

Help a newbie learn Eclipse/Android debugging best practices

I am a newbie to Android and the Eclipse development environment and would like some advice on best practices for debugging my apps when they throw a Force Close.
I have researched ADB, however, I can not get this to interact with my phone even though I have explicitly turned debug mode to true on my test handset.
Obviously Android comes with a LOG method which I have seen utilized in many example apps, can someone please explain how to review these logs quickly and how to setup logging appropriately to determine the cause of a Force Close (always occurs when I push the Home button).
Any advice on debugging effectively in Eclipse would be much appreciated!
Sincerely,
Ryan
To debug using your device, you will need to have debug mode turned on (which it sounds like you do), you will then need to have the phone plugged in with the USB connector. From here, you can tell Eclipse to run/debug.
Eclipse should ask which device to use (this is done because there should be multiple devices available for running/debugging since your device is plugged in). At this point, you can select your actual device from the list, and you should be up and running.
If you are using android.util.Log, then your logs will show up in LogCat. If you do not see LogCat by default in your Eclipse environment, you can add it by doing the following:
Go to Window -> Show View -> Other
Select Android -> LogCat
Cick OK.
When running/debugging your device, you should see your Log statments in LogCat.
As I have never been able to get Eclipse to refresh the LogCat when I'm debugging on device, I will add this :
You can also debug from command line like this :
"adb -d logcat"
However, as the windows command line is awfully basic, the line are cut in 2 most of the time.
And my asking about your OS does help because the procedure is not the same to set up device debugging if you are on windows or linux or mac.
For instance, in the case of windows, you need to install a driver (you can find all the doc here) before being able to debug on a device.

Categories

Resources