0

我正在用 Eclipse 构建一个 Android 应用程序,一切都很顺利,直到我添加了一个特定的 KeyEvent 代码。一旦我尝试模拟我的应用程序,它就会崩溃并死掉。我多次尝试清理它,但没有得到解决。此外,当我尝试编辑源路径时,源会显示片刻,但会消失。以下是未找到的来源:

ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 2159    
ActivityThread.handleLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 2189 
ActivityThread.access$600(ActivityThread, ActivityThread$ActivityClientRecord, Intent) line: 139    
ActivityThread$H.handleMessage(Message) line: 1261  
ActivityThread.main(String[]) line: 4894    
ZygoteInit$MethodAndArgsCaller.run() line: 784  
ZygoteInit.main(String[]) line: 551 
NativeStart.main(String[]) line: not available [native method]  

我怎样才能让它们变得可以使用?我非常接近我的应用程序准备就绪。这是我的应用程序中唯一的挫折。

编辑:这是 logcat 输出:

08-12 10:52:02.359: E/AndroidRuntime(23219): FATAL EXCEPTION: main
08-12 10:52:02.359: E/AndroidRuntime(23219): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mshaw.avanos/com.mshaw.avanos.AvanosActivity}:       java.lang.NullPointerException
08-12 10:52:02.359: E/AndroidRuntime(23219):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2075)
08-12 10:52:02.359: E/AndroidRuntime(23219):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2189)
08-12 10:52:02.359: E/AndroidRuntime(23219):    at android.app.ActivityThread.access$600(ActivityThread.java:139)
08-12 10:52:02.359: E/AndroidRuntime(23219):    at  android.app.ActivityThread$H.handleMessage(ActivityThread.java:1261)
08-12 10:52:02.359: E/AndroidRuntime(23219):    at android.os.Handler.dispatchMessage(Handler.java:99)
08-12 10:52:02.359: E/AndroidRuntime(23219):    at android.os.Looper.loop(Looper.java:154)
08-12 10:52:02.359: E/AndroidRuntime(23219):    at android.app.ActivityThread.main(ActivityThread.java:4894)
08-12 10:52:02.359: E/AndroidRuntime(23219):    at java.lang.reflect.Method.invokeNative(Native Method)
08-12 10:52:02.359: E/AndroidRuntime(23219):    at java.lang.reflect.Method.invoke(Method.java:511)
08-12 10:52:02.359: E/AndroidRuntime(23219):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
08-12 10:52:02.359: E/AndroidRuntime(23219):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
08-12 10:52:02.359: E/AndroidRuntime(23219):    at dalvik.system.NativeStart.main(Native Method)
08-12 10:52:02.359: E/AndroidRuntime(23219): Caused by: java.lang.NullPointerException
08-12 10:52:02.359: E/AndroidRuntime(23219):    at com.mshaw.avanos.SimpleEula.getPackageInfo(SimpleEula.java:25)
08-12 10:52:02.359: E/AndroidRuntime(23219):    at com.mshaw.avanos.SimpleEula.show(SimpleEula.java:33)
08-12 10:52:02.359: E/AndroidRuntime(23219):    at com.mshaw.avanos.AvanosActivity.<init>(AvanosActivity.java:36)
08-12 10:52:02.359: E/AndroidRuntime(23219):    at java.lang.Class.newInstanceImpl(Native Method)
08-12 10:52:02.359: E/AndroidRuntime(23219):    at java.lang.Class.newInstance(Class.java:1319)
08-12 10:52:02.359: E/AndroidRuntime(23219):    at android.app.Instrumentation.newActivity(Instrumentation.java:1039)
08-12 10:52:02.359: E/AndroidRuntime(23219):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2066)
08-12 10:52:02.359: E/AndroidRuntime(23219):    ... 11 more
4

1 回答 1

0

按照这些步骤
1) 转到您的调试视图
2) 在断点选项卡下,您将看到 NullPointerException
3) 右键单击​​并取消选中已捕获。
4)再次调试您的项目

希望这会帮助你。谢谢

于 2013-05-14T10:41:26.647 回答