Hi there,

I'm trying to get some form of automatic crash reporting working for the app
I'm developing using  http://code.google.com/p/acra/ acra . I've
successfully created a callable wrapper for the acra-4.2.3.jar and my
project builds, runs, and appears to call ACRA.Init() without any problems.

The main trouble I have is how to translate the annotation syntax from Java
to C#. I.e. In a java app, you specify the google form to send crash reports
to using this syntax:

        @ReportsCrashes(formKey = "dGVacG0ydVHnaNHjRjVTUTEtb3FPWGc6MQ") 
        public class MyApplication extends Application {
                ...
        }

I see M4A 4.2 has support for annotations but the generated ACW doesn't seem
to contain any 'ReportsCrashesAttribute'.
To work around this, I tried to create a 'GoogleFormSender' explicitly
passing the form key as a construction parameter, but discovered the
'addReportSender' method is missing in the wrapper.

So I tried the following instead:

        IntPtr java_class_handle = IntPtr.Zero;
        IntPtr class_ref = JNIEnv.FindClass ("org/acra/ErrorReporter", ref
java_class_handle);
        IntPtr method = JNIEnv.GetMethodID(class_ref, "addReportSender",
"(Lorg/acra/sender/ReportSender;)V");
        JNIEnv.CallVoidMethod(Org.Acra.ErrorReporter.Instance.Handle, method, 
new
JValue(new Org.Acra.Sender.GoogleFormSender(FormKey)));

This appeared to work, but when I try to report an error using:

        Org.Acra.ErrorReporter.Instance.HandleSilentException(new 
Throwable("Test
Problem"));

Logcat reports that it failed:
        E/Visions Live BB(30458): Failed to send crash reports
        E/Visions Live BB(30458): java.lang.NullPointerException
        E/Visions Live BB(30458):  at
org.acra.sender.GoogleFormSender.remap(GoogleFormSender.java:73)
        E/Visions Live BB(30458):  at
org.acra.sender.GoogleFormSender.send(GoogleFormSender.java:52)
        E/Visions Live BB(30458):  at
org.acra.ErrorReporter.sendCrashReport(ErrorReporter.java:850)
        E/Visions Live BB(30458):  at
org.acra.ErrorReporter.checkAndSendReports(ErrorReporter.java:960)
        E/Visions Live BB(30458):  at
org.acra.ErrorReporter$ReportsSenderWorker.run(ErrorReporter.java:142)

>From looking through the ACRA source code this is because the ACRA static
class has a null pointer to a 'ReportsCrashes' object that it would normally
get from the annotation.

So anyway, I was wondering if anyone has had any luck with automatic crash
reporting in a M4A project, and whether they could give me a leg up this.
I see in this post:
http://mono-for-android.1047100.n5.nabble.com/How-can-I-use-bug-trackers-like-Acra-or-BugSense-td5157636.html
that there are issues with unhandled exceptions not being caught but I was
planning to use high level "catch all" exception handlers that would report
anything caught as a crash.

Any help much appreciated,
Paul

--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Automatic-crash-reporting-tp5710823.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

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

Reply via email to