We are adding BugSense to Cupid-4-Stupid (http://www.cupid-4-stupid.com) for Android.
BugSense (http://www.bugsense.com/) is a bug tracking service for Android, iOS, and WP7 which works wonders with ACRA 4.2.3.
We added BugSense after encounter an error with ACRA in which was crashing the application.
The code was failing when trying to initialize acra:
try{ ACRA.init(this); // The following line triggers the initialization of ACRA }catch(RuntimeException e){ android.util.Log.e(TAG, 'ACRA init crashes: ' + e.getMessage()); e.printStackTrace(); }
Getting the following error:
10-30 22:02:37.908: WARN/System.err(2709): java.lang.NullPointerException 10-30 22:02:37.918: WARN/System.err(2709): at org.acra.ErrorReporter.init(ErrorReporter.java:363) 10-30 22:02:37.918: WARN/System.err(2709): at org.acra.ACRA.initAcra(ACRA.java:297) 10-30 22:02:37.918: WARN/System.err(2709): at org.acra.ACRA.init(ACRA.java:238) 10-30 22:02:37.918: WARN/System.err(2709): at com.hourglass.applications.MyApplication.onCreate(MyApplication.java:40) 10-30 22:02:37.918: WARN/System.err(2709): at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:969) 10-30 22:02:37.928: WARN/System.err(2709): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4165) 10-30 22:02:37.928: WARN/System.err(2709): at android.app.ActivityThread.access$2900(ActivityThread.java:126) 10-30 22:02:37.928: WARN/System.err(2709): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1958) 10-30 22:02:37.928: WARN/System.err(2709): at android.os.Handler.dispatchMessage(Handler.java:99) 10-30 22:02:37.928: WARN/System.err(2709): at android.os.Looper.loop(Looper.java:123) 10-30 22:02:37.928: WARN/System.err(2709): at android.app.ActivityThread.main(ActivityThread.java:4568) 10-30 22:02:37.928: WARN/System.err(2709): at java.lang.reflect.Method.invokeNative(Native Method) 10-30 22:02:37.938: WARN/System.err(2709): at java.lang.reflect.Method.invoke(Method.java:521) 10-30 22:02:37.938: WARN/System.err(2709): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 10-30 22:02:37.938: WARN/System.err(2709): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 10-30 22:02:37.938: WARN/System.err(2709): at dalvik.system.NativeStart.main(Native Method)
After spending long hours I found how that the error was produced when ErrorReporter class was not initialized.
For some reason ACRA 4.2.3 doesn’t pass the reference of the class (this) to ErrorReporter.
To fix it just implement the following:
ErrorReporter.getInstance().init(this); // include before ACRA.init(this);
© 2011 – 2012, Alejandro G. Carlstein Ramos Mejia. All rights reserved.