我收到了第一个例外。现在我该怎么办?
我对所有这些疯狂的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该查看 BillingHelper.java 中的第 270 行和 BillingConverter 中的第 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
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.
您在执行代码时遇到“
异常
”。基本上,出了什么问题。 Oracle的定义是“异常是在程序执行过程中发生的事件,它扰乱了程序指令的正常流程。”看看此处 了解更多信息
特别是您遇到了 NPE,
NullPointerException
来自 Javadoc:
抛出时应用程序在需要对象的情况下尝试使用 null。其中包括:
换句话说,你的程序期望一些对象,但没有得到任何回报。
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:
In other words, your program expected some object and got nothing in return.