Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Highlighted
New Contributor
Posts: 5
Registered: ‎04-10-2012
My Device: Black Berry Curve
My Carrier: company

It is too hard to debug a webwork javascript extension on MAC!

[ Edited ]

It is so frustrating that you can do nothing while developing a webwork javascript extension and it failed to run.

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.

 

Basically I can not find any tutorial covering `debug javascript extension on mac`.

 

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.

 

Retired
Posts: 856
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: It is too hard to debug a webwork javascript extension on MAC!

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-APIs/tree/master/Smartphone/TEMPLATE

 

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-APIs/tree/master/Smartphone/systemlog

 

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.

Tim Windsor
Open Source Technical Lead