11

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?

user1301428
  • 1,743
  • 3
  • 25
  • 57

7 Answers7

13

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.
NT_
  • 2,216
  • 1
  • 18
  • 23
  • Is this equivalent to the solution proposed by @Ares? – user1301428 May 07 '12 at 11:33
  • @user1301428 Yes. But more practical. When you debug the application directly in your phone from eclipse ,instead of using the emulator, You will get more practical logcat output. And when you debug using your phone instead of emulator, the Eclipse/DDMS will automatically turn your phone into debug mode for that user session ( Read as , till restarting phone ). Ares suggested you to turn on the Debug mode on phone using the DDMS panel However, It would be more appropriate to directly debug your phone with the app than just turning on the debug mode from DDMS alone. – NT_ May 07 '12 at 11:57
  • Could you explain exactly what happens when I only turn on ADB mode from DDMS and what happens when I run the app in debug mode? – user1301428 May 07 '12 at 12:14
  • @user1301428 ,See the edit. And accept this as solution if your doubts are cleared. :) – NT_ May 07 '12 at 22:27
  • Thank you for the edit. One last question: so basically, turning the debug mode on is what Ares suggested? – user1301428 May 08 '12 at 07:35
  • @user1301428 I'm assuming that Ares was suggesting you to make the applications /processes run in 'debug mode'. And that is not exactly the same as turning the debug mode on (ADB) . – NT_ May 10 '12 at 06:53
5

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

Community
  • 1
  • 1
Adreamus
  • 670
  • 7
  • 15
1

Install a tool like AndroidSystemInfo that can show you the logfile on the phone - even when you are away from the host computer.

It is pretty unusual that Android leaves no trace whatsoever.

Does your app perhaps require features that the phone does not have (e.g. a camera or gps or nfc)?

Heiko Rupp
  • 30,426
  • 13
  • 82
  • 119
1

In Eclipse you should go to DDMS, then click on device's name or android.os in Devices panel. And turn your device in debug mode.

Nolesh
  • 6,848
  • 12
  • 75
  • 112
  • I've already enabled debug mode from the phone settings, isn't this the same thing as the one you are suggesting? – user1301428 May 07 '12 at 12:30
0

Put your own logs to track what block of code cause crashe, or just debug it.

Dmytro Danylyk
  • 19,684
  • 11
  • 62
  • 68
  • 1
    I had very similair problem - app crashed (connected to my PC with ADB/AndroidStudio running) and no traces in log has been leaved. Moreover AOS doesn't show me usual for such cases DialogBox like "Unfortunately the @app has been stopped". It looks like if I tapped the system Home key, app is just disappearing. I guess its due to NDK lib which is used in app, so its like a crash from the very low level, before any crash-reporters could even catch it. – Stan Jun 13 '15 at 07:36
0
  1. You can reset adb (In Devices -> View menu -> Reset adb)
  2. Click on the selected online device/emulator to show the logcat
  3. Disconnect the cable and again connect it. (Or restart the emulator)
  4. Restart Eclipse
nhahtdh
  • 55,989
  • 15
  • 126
  • 162
AmDroid
  • 131
  • 5
0

I restarted my emulator and cleaned my build. This got rid of both the non-logging and the spurious crash I was having

Bruno Carrier
  • 530
  • 5
  • 8