简体   繁体   中英

Debugging blackberry library

I have a workspace with the following 3 projects: Library Tests GUI

The tests only hit the library. This is a BB project with the type set to "library" All my tests seem to be working and hitting the code. If I debug the tests using JUnit, I can step in to a function in my library, view my variables and all the normal debugging goodness.

I created the GUI and included the library in the Required Projects build path.

The problem I have is trying to debug the library via the GUI on the simulator. When I debug the application I can find my App easily enough. Right now it's a single button that makes a simple call into the library.

For example, something like:

FieldChangeListener checkListener = new FieldChangeListener() { public void fieldChanged(Field field, int context) {
LibraryClass lc = new LibraryClass();
Dialog.Alert("Class loaded");
}};

If I put a break point on the LibraryClass lc = new LibraryClass() Eclipse will break in on the button press.

If I step over this method nothing happens. The code never advances to the Dialog.Alert() line.

If I try to step into the constructor and see what's hanging it up in there, nothing happens. Eclipse never steps in.

At first I thought maybe this was some kind of timing issue where the GUI thread needed to do something and so my library call got lost.

I've tried creating a class that implements Runnable so that I can call a ThreadClass.Run() and have THAT class fire up the library calls. But it behaves the same.

There are no exceptions thrown, it just seems as if it walked off the end of the Earth.

Does anyone have any idea or seen anything like this? Is it a configuration issue on the simulator where it's not including the library? Did I miss something obvious?

It turns out that apparently my library call is throwing a NoClassDefFoundError

It's not an exception, just an error. So apparently my app was just swallowing the error. Unfortunately, the stack trace on the catch block is empty, so I'm not sure exactly where this is occurring. But at least that's more information than I previously had.

Found the error. Blackberry was compiling against jdk 1.6 which converted string concatenation to StringBuilder. However, the JRE didn't support StringBuilder. I changed compilation framework to 1.4 and everything worked fine.

I posted the whole process in my blog .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM