On Jul 20, 2012, at 8:28 AM, jayemmess wrote:
> I've inherited a project built using Mono for Android and need establish why 
> it is occasionally crashing.  I have no prior experience of Android or Mono, 
> but am a .net developer.

Which Mono for Android version? Which target device? Which Android version on 
the Target device?

> The log seems to show that the crashes are happening for a number of 
> different reasons, though that could just be me not understanding what the 
> logs are telling me.
> 
> I've published one of the logs here: http://pastebin.com/KnzdKikM

The first thing to note is that the messages have structure:

        TimeStamp       Message-Level/Tag       (PID): Message

For example:

        07-20 19:33:23.585 E/MessageQueue(  479):

The timestamp is "07-20 19:33:23.585".

The Message-Level is "E" (Error).

The Tag is "MessageQueue."

The PID is 479.

The Message is "Error: NameResolutionFailure."

If you read through that log, you'll notice that there are _lots_ of different 
pids. Note all of them are relevant to your app's execution, so the first thing 
to do is to determine which messages are relevant:

        
http://docs.xamarin.com/android/advanced_topics/android_debug_log#Interesting_Messages

Search for "__mono"; this finds messages generated during process startup, from 
the executing process:

        07-20 19:33:02.215 I/ActivityThread(  479): Pub app.my.__mono_init__: 
mono.MonoRuntimeProvider

That message gives us a pid (479), which greatly narrows down the output: Lots 
of messages from 479 are NameResolutionFailure messages, suggesting that 
there's some kind of network issue. A quick sanity check is to see if the 
Browser app on your device is able to access the same website that your app is 
trying to access.

We can also see that the gref count is constantly increasing:

        07-20 19:36:13.825 D/dalvikvm(  479): GREF has increased to 1301

This is usually a sign that the GC isn't running frequently enough, or you're 
constantly creating new objects which are referenced by both VMs:

        http://docs.xamarin.com/android/advanced_topics/garbage_collection
        http://docs.xamarin.com/android/advanced_topics/diagnostics

This is troubling though:

        07-20 19:36:22.795 I/mono    (  479): Stacktrace:
        07-20 19:36:22.795 I/mono    (  479):

There's an exception, but no stack trace. Fun. :-(

So search backwards, and:

        07-20 19:36:22.555 I/InputQueue-JNI(  479): Ignoring finish signal on 
channel that is no longer registered.

So timewise, shortly after your app generates an "InputQueue-JNI" message, it 
does something that results in an unhandled exception. Search your app source 
for "InputQueue-JNI", and try to understand the surrounding logic and see what 
would be executed afterward.

> It seems that the app was in this instance terminated due to an ANR. Would 
> anyone be able to tell me if that log shows why the ANR occurred or advise me 
> on how I should go about debugging the issue?

You'd want to read the ANR log:

        07-20 19:36:31.195 I/dalvikvm(  479): Wrote stack traces to 
'/data/anr/traces.txt'

So grab that file:

        adb pull /data/anr/traces.txt

You won't get a complete stack trace, but it may be enough to help.

 - Jon

_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to