04-10-2012 04:30 AM - edited 04-10-2012 04:48 AM
First of all, there's still no blackberry simulator for MAC so you have to run your draft app on a real device. and real device always restart after `javareload load app.cod` and the restarting process is unbelievable slow. Then everytime you change a piece of code then waiting for a long time to restart your BB and may still face to be failed to run by some bugs.
Secondly, it seems no way to print debug information to terminal. Is there anyway like we do as in android app development in which we can use `logcat` to connect to a real device to get error messages or exception stack?
So we keep waiting our BB to restart again and again and keep building and signing the app again and again and still can't find out where the bug is or what the real error message is from which we can finally fix the bug.
And today I wasted my whole day to fix a small bug that I mistyping WidgetExtension with WidgetException
The app always failed to load.
After pressing "alt LGLG" I got ClassCastException and I didn't know where the exception came from and the worst thing is I could not debug it and the compiler don't even give a little cue.
05-23-2012 12:03 PM
One option is to use a unit tester like Qunit as we did in our template for WebWorks Extensions here: https://github.com/blackberry/WebWorks-Community-A
Running a suite of tests on the extension should get a lot of bugs before you even try to use it in an app.
When running on a real device you can see exceptions and messages in the Event Log. Hold Alt and press LGLG to access it on the device. Set it to the lowest level to get detailed logs of what is happening on the device.
You can use "Javaloader -u eventlog > log.txt" to copy the eventlog into a file on the computer, for easier viewing and searching.
Also, you can write your own logs out to the Eventlog in your extension. Highly recommended if you want to debug on a device. There is an existing extension here you can use to get code samples: https://github.com/blackberry/WebWorks-Community-A
Lastly, if you build your application with the -s option, then you can load the resulting application source into Eclipse to debug as well. That will help with some issues, though you will still need to debug on a device with Mac.