我收到了第一个例外。现在我该怎么办?

发布于 2024-12-07 00:27:56 字数 1850 浏览 1 评论 0原文

我对所有这些疯狂的 Android/Java 编程都是新手。我有一个应用程序(不知何故)我设法弄清楚如何添加应用程序内计费项目。我很确定该错误与应用内结算有关,但我无法在我的任何设备上重现该问题。

    NullPointerException
    in ComponentName.<init>()

    java.lang.RuntimeException: Unable to destroy activity {ca.ajwest.BeerConverter/ca.ajwest.BeerConverter.BeerConverter}: java.lang.NullPointerException
    at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3035)
    at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3100)
    at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3216)
    at android.app.ActivityThread.access$1600(ActivityThread.java:132)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1037)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:143)
    at android.app.ActivityThread.main(ActivityThread.java:4196)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:507)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
    at dalvik.system.NativeStart.main(Native Method)
    Caused by: java.lang.NullPointerException
    at android.content.ComponentName.<init>(ComponentName.java:75)
    at android.content.Intent.<init>(Intent.java:2893)
    at ca.ajwest.BeerConverter.BillingHelper.stopService(BillingHelper.java:270)
    at ca.ajwest.BeerConverter.BeerConverter.onDestroy(BeerConverter.java:615)
    at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3017)
    ... 12 more

有人可以指导我访问一些资源,在那里我可以了解有关此输出或其他内容的更多信息吗?有人有类似的经历吗?

这是来源(如果有帮助的话)。

感谢您的帮助。

I'm new to all this crazy Android/Java programming stuff. I have an app that (somehow) I managed to figure out how to add in-app billing items to. I'm pretty sure the error is related to in-app billing, but I'm not able to reproduce the problem on any of my devices.

    NullPointerException
    in ComponentName.<init>()

    java.lang.RuntimeException: Unable to destroy activity {ca.ajwest.BeerConverter/ca.ajwest.BeerConverter.BeerConverter}: java.lang.NullPointerException
    at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3035)
    at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3100)
    at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3216)
    at android.app.ActivityThread.access$1600(ActivityThread.java:132)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1037)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:143)
    at android.app.ActivityThread.main(ActivityThread.java:4196)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:507)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
    at dalvik.system.NativeStart.main(Native Method)
    Caused by: java.lang.NullPointerException
    at android.content.ComponentName.<init>(ComponentName.java:75)
    at android.content.Intent.<init>(Intent.java:2893)
    at ca.ajwest.BeerConverter.BillingHelper.stopService(BillingHelper.java:270)
    at ca.ajwest.BeerConverter.BeerConverter.onDestroy(BeerConverter.java:615)
    at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3017)
    ... 12 more

Could somebody please direct me to some resources where I can learn more about this output or something? Does anybody have any similar experiences?

Here's the source if that helps at all.

Thanks for your help.

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

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

发布评论

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

评论(2

云雾 2024-12-14 00:27:56

您应该查看 BillingHelper.java 中的第 270 行和 BillingConverter 中的第 615 行。在错误日志中,您应该主要查找两件事;首先是与您的应用程序名称相关的行号,其次是;异常的名称。

您会看到

Caused by: java.lang.NullPointerException
at android.content.ComponentName.<init>(ComponentName.java:75)
at android.content.Intent.<init>(Intent.java:2893)
at ca.ajwest.BeerConverter.BillingHelper.stopService(BillingHelper.java:270)
at ca.ajwest.BeerConverter.BeerConverter.onDestroy(BeerConverter.java:615)

,您的一个类中存在空指针异常。还注明了行号以供检查。应该有一个变量,该变量尚未初始化或已被销毁。

我希望这有帮助。

You should look your line 270 in BillingHelper.java and line 615 in BillingConverter. In error log, you should look for mainly two things; first, a line number which is related with your application names, second; name of the exception.

You see that

Caused by: java.lang.NullPointerException
at android.content.ComponentName.<init>(ComponentName.java:75)
at android.content.Intent.<init>(Intent.java:2893)
at ca.ajwest.BeerConverter.BillingHelper.stopService(BillingHelper.java:270)
at ca.ajwest.BeerConverter.BeerConverter.onDestroy(BeerConverter.java:615)

says, there is a null pointer exception in one of your classes. Line numbers are also noted to check. There should be a variable, which isn't initialized or already destroyed.

I hope that helps.

尾戒 2024-12-14 00:27:56

在此处输入图像描述

您在执行代码时遇到“异常”。基本上,出了什么问题。 Oracle的定义是“异常是在程序执行过程中发生的事件,它扰乱了程序指令的正常流程。”

看看此处 了解更多信息

特别是您遇到了 NPE,NullPointerException

来自 Javadoc

抛出时应用程序在需要对象的情况下尝试使用 null。其中包括:

  • 调用空对象的实例方法。
  • 访问或修改空对象的字段。
  • 将 null 的长度视为数组。
  • 访问或修改 null 的槽,就好像它是一个数组一样。
  • 抛出 null 就像它是一个 Throwable 值一样。

换句话说,你的程序期望一些对象,但没有得到任何回报。

enter image description here

You got an "Exception", while executing your code. Basically, something went wrong. Oracle's definition is "An exception is an event, which occurs during the execution of a program, that disrupts the normal flow of the program's instructions."

Take a look here to learn more

In particular you got the NPE, NullPointerException

From Javadoc:

Thrown when an application attempts to use null in a case where an object is required. These include:

  • Calling the instance method of a null object.
  • Accessing or modifying the field of a null object.
  • Taking the length of null as if it were an array.
  • Accessing or modifying the slots of null as if it were an array.
  • Throwing null as if it were a Throwable value.

In other words, your program expected some object and got nothing in return.

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