当应用程序启动并关闭时,我得到了 java.lang.NullPointerException。来自模拟器的错误是“不幸的是,appname 已停止”。它工作正常,直到我编写了一堆新代码并更改了清单。希望它不是清单,但我的问题是,我怎样才能找出问题所在的代码行?跟踪转储对我来说没有任何意义,即使它很冗长,拥有 ...11 更多也不能让我看到整个事情。
我真的不知道那个错误是什么意思。我已经搜索过它,但似乎有一个它可能意味着的东西的列表。我已经尝试过 Project>Clean,我已经尝试再次弄乱清单,但我仍然得到错误。我已经检查/未检查外部库。刚刚做了人们建议为其他人做同样错误的事情。所以我真的很想知道,是什么线触发了它?
如果这有帮助,这是输出:
06-29 08:37:23.680: E/AndroidRuntime(1225): FATAL EXCEPTION: main
06-29 08:37:23.680: E/AndroidRuntime(1225): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.upliftly.android/com.upliftly.android.UpliftlyActivity}: java.lang.NullPointerException
06-29 08:37:23.680: E/AndroidRuntime(1225): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1879)
06-29 08:37:23.680: E/AndroidRuntime(1225): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
06-29 08:37:23.680: E/AndroidRuntime(1225): at android.app.ActivityThread.access$600(ActivityThread.java:122)
06-29 08:37:23.680: E/AndroidRuntime(1225): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
06-29 08:37:23.680: E/AndroidRuntime(1225): at android.os.Handler.dispatchMessage(Handler.java:99)
06-29 08:37:23.680: E/AndroidRuntime(1225): at android.os.Looper.loop(Looper.java:137)
06-29 08:37:23.680: E/AndroidRuntime(1225): at android.app.ActivityThread.main(ActivityThread.java:4340)
06-29 08:37:23.680: E/AndroidRuntime(1225): at java.lang.reflect.Method.invokeNative(Native Method)
06-29 08:37:23.680: E/AndroidRuntime(1225): at java.lang.reflect.Method.invoke(Method.java:511)
06-29 08:37:23.680: E/AndroidRuntime(1225): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-29 08:37:23.680: E/AndroidRuntime(1225): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-29 08:37:23.680: E/AndroidRuntime(1225): at dalvik.system.NativeStart.main(Native Method)
06-29 08:37:23.680: E/AndroidRuntime(1225): Caused by: java.lang.NullPointerException
06-29 08:37:23.680: E/AndroidRuntime(1225): at android.content.ContextWrapper.getApplicationContext(ContextWrapper.java:101)
06-29 08:37:23.680: E/AndroidRuntime(1225): at com.upliftly.android.UpliftlyActivity.<init>(UpliftlyActivity.java:19)
06-29 08:37:23.680: E/AndroidRuntime(1225): at java.lang.Class.newInstanceImpl(Native Method)
06-29 08:37:23.680: E/AndroidRuntime(1225): at java.lang.Class.newInstance(Class.java:1319)
06-29 08:37:23.680: E/AndroidRuntime(1225): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
06-29 08:37:23.680: E/AndroidRuntime(1225): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1870)
06-29 08:37:23.680: E/AndroidRuntime(1225): ... 11 more