Java ME 应用程序在模拟器中运行良好,但在部署到 N70 时崩溃。有什么方法可以确定崩溃的原因吗?

发布于 2024-09-01 03:50:22 字数 285 浏览 7 评论 0 原文

我为 CLDC 平台开发了一个 Java ME 应用程序。在模拟器中执行时效果很好。但是当我将其部署到 N70 手机时,应用程序根本无法在手机中启动。在我的应用程序中,有大约 14 个类,我正在为每个类创建一个实例,并在应用程序启动时将它们放入向量中。这些类只有 1 个变量和 2 个方法。创建大量实例可能是其崩溃的原因吗?

有什么办法可以找出应用程序无法在手机中启动的原因吗?

更新: 它在模拟器上运行良好。我想提的另一件事是 - 代码仅在创建这 14 个实例并将它们添加到向量时停止执行。到那时,代码就可以正常执行了。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

手心的海 2024-09-08 03:50:22

这可能取决于您在代码中创建这些实例的位置。如果您在 MIDlet 构造函数或 startApp 方法中创建它们,请尝试将初始化移至应用程序的 run 方法中。

调试不在手机上启动的 J2ME 应用程序的一种方法是在要写入记录存储系统的代码中添加“printf”样式的调试消息,并向应用程序添加另一个 MIDlet 以从 RMS 读取并显示这些消息。
或者您可以只注释一些代码并查看它是否有效。

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.

溺深海 2024-09-08 03:50:22

您可以在设备上进行调试。如果您使用的模拟器是诺基亚 SDK 的一部分,那么其他地方应该有工具可以进行设备上测试和调试。 (我会对此发布更多详细信息,但我最近只在索尼爱立信手机上做过此操作。)

另一种选择是使用 诺基亚工具,允许您查看应用程序的标准输出和错误正在您的设备上运行(例如通过蓝牙)。

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).

浅浅 2024-09-08 03:50:22

您的应用程序实际上使 Java 虚拟机字节码解释器线程崩溃并终止整个本机进程的可能性非常小。

这种情况以前也发生过,但您需要先消除其他几个潜在问题,然后才能确信确实发生了崩溃。

更有可能的是:

  • 您的 MIDlet 未创建或未启动,因为 MIDP 运行时认为它不正确。
    或者
  • 您的 MIDlet 只是抛出一个您没有捕获的异常,这可能使它看起来像是被残酷终止的。

由于 MIDlet 安装程序应该阻止您安装错误的 MIDlet,因此更有可能出现未捕获的异常问题。

如何查找未捕获的异常:

  • 从最简单的 HelloWorld MIDlet 开始,使用 Form,这样您就可以轻松地在屏幕顶部插入更多 StringItem
  • MIDlet.startApp() 中创建并启动一个新的 Thread
  • 在覆盖 Thread.run() 中,添加 try{ }catch(Throwable){} 块。
  • 在该块内,执行原始 MIDlet 执行的操作。
  • 使用该表单作为调试的标准输出。

您可以使用表单日志记录来确保不会进入无限循环、显示异常类和消息、标记逻辑里程碑、显示变量值...

这是弄清楚正在发生的情况的第一步。

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.

执笏见 2024-09-08 03:50:22

我也遇到了类似的问题,当我将 MIDLET 重新编译为 Midlet 1.0 时,它工作得很好。 N70似乎无法运行新版本的MIDLET。我认为您降级并重新测试您的 midlet。

问候

朱奈德

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文