Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What to do when app crashes and logcat shows no errors

Tags:

android

logcat

The app works fine in the emulator, but after installation on a phone, it crashes every time on launch, and logcat shows no errors.

What am I supposed to do when something like this happens?

like image 842
user1301428 Avatar asked May 03 '12 12:05

user1301428


2 Answers

My Suggestion for easier resolution of your problem :

Run the app from the eclipse in debug mode on the Phone . It will make it run on debug mode. You will most likely get more debug output.

  1. Turn on ADB in the phone.
  2. Connect the Phone to the PC
  3. Run as "Debug Configuration" from eclipse.
  4. It should run from your phone and Eclipse will ask for your choice for first time before running that.

Turning the Debug Mode on ( Note : This isn't the 'ADB connection' we are referring to ) , It will enable further logging of the application and doesn't do garbage collection normally.

( You will notice a 'Waiting for debug connection' dialogue , if the applications are forced to work in debug mode ).

For e.g :It makes the Async threads keep running and doesn't stop running. Crude and irrelevant for your case . But just as an example.

So , Since the Applications in the phone are forced to run in debug mode , it will get the logcat with detailed errors down to the specific threads.

However, the debug mode is better used when it's used in conjunction with "Debug As" run configuration from Eclipse. And keep in mind that it will automatically turn on that debug application mode ( And there by the dialog box also) , the logcat will show you more details and plus it will break-point at the errors which occur ,in their sequence of occurence.


Regarding what Ares told, When you want to do the debugging of a process directly,

  1. You can go to the DDMS panel in Eclipse,
  2. On the right side tab menu Devices ,
  3. Select the process you want to debug . and click on the green symbol ( Says, Start Debugging process )
  4. It will automatically go to the source when it breaks if you have the source code in that eclipse work-space.
like image 143
NT_ Avatar answered Oct 24 '22 23:10

NT_


Additional hint:

On huawei phones, logcat doesn't show debug messages and excpetions, if the phone is in default system settings.

In order to enable logcat full logs on Huawei phones, you must do the following:

  • Open the factory settings menu by dialing *#*#2846579#*#*
  • Navigate to Project Menu / Background Setting / Log setting

  • On older phones: define the log availability (log switch) and level (log level setting).

  • On never phones: tick AP Log (which seems to enable app logging in general) and CP Log (seems to enable debug logging)
  • Close the menu with your backbutton (no restart needed)

Source: https://stackoverflow.com/a/18395092/1075072

like image 25
Adreamus Avatar answered Oct 24 '22 23:10

Adreamus