05-11-2009 01:58 PM
I'm having this serious problem for some time and still haven't figured out how to solve it. I've developed 2 J2ME applications that works fine on BlackBerry devices with JDE 4.5 or higher (tested on two 8310 and one 8100 devices). I'm using Netbeans 6.5 to compile the project and I'm manually generating COD files with rapc.
The problem happens when I try to run the apps in devices with software versions older than 4.5:
I'm not using any restricted APIs and the code is not signed. Just a bare minimum of BlackBerry's API is used, mostly for event handling: net.rim.device.api.system.Application, net.rim.device.api.ui.Keypad and net.rim.device.api.ui.UiApplication .
The closest I've got to make this work was doing the following:
Among other things, this is what I concluded from my (bad) experience:
It seemed that I was making some progress, but since I began to have problems again after making simple method calls (even if it was a static method with a fully commented body), I decided to stop and ask for help. This was looking much more a matter of faith than logic, and certainly it isn't supposed to be like this.
Sorry if I didn't go further or skipped some details, but it's hard to give all details at once.
I would be REALLY grateful if anyone can give me any help to solve this!
05-11-2009 02:11 PM - edited 05-11-2009 02:17 PM
I might be missing something very simple here, but if you have created the jar file, then you have compiled your code, and if you have compiled it, then haven't you created a level dependent class (or classes) depending on the level of api jar that you have used in your compilation?
I don't know how you included the RIM API class in your Net Beans environment, but it seems to be whatever API library you have included probably defines the lowest level of OS on which your compiled code will run.
Just a thought, but note that I don't really understand what is going on here. Just trying to help....
Edit: Sorry should have said - Welcome! And I applaud your efforts to try and find the problem on your own!
05-11-2009 02:23 PM
Thanks for your reply!
Regarding to the NetBeans compilation: I've already tried compiling it using JDE 4.1 and 4.2, and both produces the same effect. This applies to both my personal libraries and app specific classes. I've tried compiling an entire jar containing both specific and library files (which NetBeans do as default, and also works fine on dozens of apps and games I've written to hundreds of J2ME devices), and also compiling just the app-specific classes, and then adding my lib's jar file in "import" rapc parameter.
I'll double-check that, but this looks odd to me anyway because in all cases rapc runs (apparently) without errors. Since I don't need anything too fancy, I'd like to compile the apps against 4.1, and then ensure maximum compatibility.
I forgot to mention before that the jar files aren't obfuscated before passing them as parameters to rapc. I'll update the post as soon as I have news.
05-11-2009 03:01 PM
05-12-2009 11:01 AM
07-02-2009 05:22 PM
Hello again everyone,
just in case of anyone experiencing these weird results: I've finally found a workaround! I couldn't manage to solve this through RAPC compiler. The only way it seems to work is to copy ALL your source and resource files to a new directory (taking care of its tree hierarchy), create a new RIM JDE project (I'm using JDE 4.1) and compile it.
I thought it would be enough to just copy all files to a directory and use RAPC compiler tool, but it put all my files on .jar/.cod root dir, so all packages and resources path got wrong (I couldn't manage to make the tool keep the original relative paths).
Once one create a script file to copy everything to its place, generate a .jdp and a .jdw file (I can't copy my script here, but I assureit's easy to create your own script ), everything works nice and easy as they should be at first place. Not having to deal with random preverification errors really makes a programmer's life much easier :-)