Java ME Application running fine in Emulator but crashing when deployed to N70. Any way to identify the reason for crashing?

StackOverflow https://stackoverflow.com/questions/2776347

  •  03-10-2019
  •  | 
  •  

Question

I have developed a Java ME application for CLDC platform. It works fine when executed in an emulator. But when i deploy it to my N70 phone the application doesn't start at all in the phone. In my application there are some 14 classes and am creating an instance of each and putting them in the vector on application start. The classes just have one variable and 2 methods. Can this creating of lot of instances be the reason for its crashing?

Is there any way I can find out the reason why the application is not able to start in the phone?

Update: Its running fine on emulator. And one more thing I would like to mention is that- The code stops executing only at the point where am creating those 14 instances and adding them to the vector. Till that point the code executes fine.

Was it helpful?

Solution

It might depend on where in the code you are creating those instances. If you are creating them in your MIDlet constructor or the startApp method try moving the initialization into the run method of your application.

One way of debugging J2ME applications that don't start on the phone is by adding "printf" style debug messages in your code to be written in the record store system and adding another MIDlet to your application to read from RMS and display those messages. Or you could just comment bits of code and see if it works.

OTHER TIPS

You can debug on device. If the emulator you are using is part of the Nokia SDK then there should be facilities elsewhere to carry out on-device testing and debugging. (I'd post more detail on this but I've only done this with Sony Ericsson phones recently.)

Another option is to use the Nokia tools that allow you to view the standard output and error for your application when it is running on your device (via Bluetooth for example).

The probability that your application is actually crashing the Java Virtual Machine bytecode interpreter thread and terminating the whole native process is very small.

It has happened before but you need to eliminate several other potential issues before being convinced of an actual crash.

It is more likely that either:

  • Your MIDlet is not created or not started because the MIDP runtime decides it is not correct.
    or
  • Your MIDlet simply throws an exception that you don't catch, which can make it look like it was brutally terminated.

Since the MIDlet installer is supposed to prevent you from installing a bad MIDlet, the uncaught exception issue is more likely.

How to find an uncaught exception:

  • Start with the simplest HelloWorld MIDlet, using a Form so you can easily insert more StringItems at the top of the screen.
  • Create and start a new Thread in MIDlet.startApp()
  • In your override of Thread.run(), add a try{}catch(Throwable){} block.
  • Inside that block, do whatever your original MIDlet did.
  • Use the form as your standard output for debugging.

You can use Form logging to make sure you don't enter an infinite loop, to display exception classes and messages, to flag logical milestones, to display variable values...

That's the first step to figuring out what is going on.

I also faced a similar problem and when I recompiled my MIDLET as Midlet 1.0 then it worked fine. It seems like N70 is not able to run the new version of MIDLET. I think you downgrade and re-test your midlet.

Regards

Junaid

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top