La aplicación de Android no se ejecutará en el emulador (p 1000) :(

I am new to android programming, and i wrote an app to add two integers. However, upon execution i recieve an error 'application (com.android.xxxx) has stopped unexpectedly. The log is as posted below. Please help me debug and understand the issue:

11-08 02:02:17.671: E/AndroidRuntime(328):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-08 02:02:17.671: E/AndroidRuntime(328):  at dalvik.system.NativeStart.main(Native Method)
11-08 02:02:17.671: E/AndroidRuntime(328): Caused by: java.lang.NullPointerException
11-08 02:02:17.671: E/AndroidRuntime(328):  at com.android.add.AdditionActivity.onCreate(AdditionActivity.java:17)
11-08 02:02:17.671: E/AndroidRuntime(328):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-08 02:02:17.671: E/AndroidRuntime(328):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
11-08 02:02:17.671: E/AndroidRuntime(328):  ... 11 more
11-08 02:35:42.461: D/AndroidRuntime(1153): Shutting down VM
11-08 02:35:42.461: W/dalvikvm(1153): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
11-08 02:35:42.501: E/AndroidRuntime(1153): FATAL EXCEPTION: main
11-08 02:35:42.501: E/AndroidRuntime(1153): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.add/com.android.add.AdditionActivity}: java.lang.NullPointerException
11-08 02:35:42.501: E/AndroidRuntime(1153):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
11-08 02:35:42.501: E/AndroidRuntime(1153):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
11-08 02:35:42.501: E/AndroidRuntime(1153):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-08 02:35:42.501: E/AndroidRuntime(1153):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-08 02:35:42.501: E/AndroidRuntime(1153):     at android.os.Handler.dispatchMessage(Handler.java:99)
11-08 02:35:42.501: E/AndroidRuntime(1153):     at android.os.Looper.loop(Looper.java:123)
11-08 02:35:42.501: E/AndroidRuntime(1153):     at android.app.ActivityThread.main(ActivityThread.java:4627)
11-08 02:35:42.501: E/AndroidRuntime(1153):     at java.lang.reflect.Method.invokeNative(Native Method)
11-08 02:35:42.501: E/AndroidRuntime(1153):     at java.lang.reflect.Method.invoke(Method.java:521)
11-08 02:35:42.501: E/AndroidRuntime(1153):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-08 02:35:42.501: E/AndroidRuntime(1153):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-08 02:35:42.501: E/AndroidRuntime(1153):     at dalvik.system.NativeStart.main(Native Method)
11-08 02:35:42.501: E/AndroidRuntime(1153): Caused by: java.lang.NullPointerException
11-08 02:35:42.501: E/AndroidRuntime(1153):     at com.android.add.AdditionActivity.onCreate(AdditionActivity.java:17)
11-08 02:35:42.501: E/AndroidRuntime(1153):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-08 02:35:42.501: E/AndroidRuntime(1153):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
11-08 02:35:42.501: E/AndroidRuntime(1153):     ... 11 more

preguntado el 08 de noviembre de 11 a las 09:11

its showing NullPointerException java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.add/com.android.add.AdditionActivity}: java.lang.NullPointerException 11-08 02:35:42.501: E/AndroidRuntime(1153): at -

see your 17th number line in your code.there is something wrong or post your code here. -

1 Respuestas

You have a NullPointerException on line 17 of AdditionActivity.java, which prevents your activity from starting up.

respondido 08 nov., 11:14

Line 17 is a closing brace :( Previous line would be btn.setOnClickListener(this). - user1035287

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.