I instrumented Newton with the acra library today. Acra registers an UncaughtExceptionHandler (which is also available in desktop Java) and everytime your application crashes bad on a user’s device it send an error report with information such as android version, phone model plus stacktrace to a Google spreadsheet you set up for that purpose. The steps to include this in your application are totally easy:
- Create the Google spreadsheet as lined out in Arca’s Wiki
- Create a class that extends CrashReportApplication and implement the getFormId() Method, returning the form id you got from your spreadsheet
- add android:name=”YourCrashReportApplicationClass” to your AndroidManifest.xml file
- …
- Crash Reports!
I especially like the solution of using Google spreadsheets for this kind of crash reporting. It also works on devices < 2.2 (down to 1.5) which is a definite plus. Finally you can add your own reports besides standard crash reports at any point in your application. With this feature you could for example log the average FPS of your game.
I used the standard crash reporting facilities of Acra and behold i got crash reports!
java.lang.NullPointerException
at at.knowcenter.pfx.gui.widgets.Label.dispose(Label.java:60)
at at.knowcenter.pfx.gui.Gui.removeWidgets(Gui.java:170)
at at.knowcenter.pfx.gui.Gui.render(Gui.java:136)
at com.badlogic.newton.game.MainMenu.render(MainMenu.java:167)
at com.badlogic.newton.game.Game.render(Game.java:126)
at at.knowcenter.pfx.backends.opengles.OpenGLESApplication.onDrawFrame(OpenGLESApplication.java:317)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:955)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:887)
Now that is nasty. Gui widgets in Newton are initialized in a lazy fashion. If the user is fast enough i try to dispose something which has not been initialized yet.
I hereby fully recommend the use of Acra in your application! The code is solid and doesn't do anything nasty (e.g. send your stats to a 3rd party).





