无法运行应用程序

时间:2017-06-25 11:25:05

标签: javascript java android

我正在制作一个常规应用程序,仅用于测试和学习,每次我添加任何视图或方法等..应用程序运行良好,我添加1个复选框后我根本无法运行应用程序虽然没有错误MainActivity.Java文件以及activity_main.xml中我也检查过多次,并且everthing很好。 我检查了android监视器并从logcat

获得了这个
06-25 15:13:38.001 27424-27424/? E/Zygote: v2
06-25 15:13:38.011 27424-27424/? E/Zygote: accessInfo : 0
06-25 15:13:39.001 27424-27424/com.example.android.justjava E/AndroidRuntime: FATAL EXCEPTION: main
                                                                              Process: com.example.android.justjava, PID: 27424
                                                                              java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.android.justjava/com.example.android.justjava.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.Window$Callback android.view.Window.getCallback()' on a null object reference
                                                                                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3133)
                                                                                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3416)
                                                                                  at android.app.ActivityThread.access$1100(ActivityThread.java:230)
                                                                                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1822)
                                                                                  at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                  at android.os.Looper.loop(Looper.java:148)
                                                                                  at android.app.ActivityThread.main(ActivityThread.java:7409)
                                                                                  at java.lang.reflect.Method.invoke(Native Method)
                                                                                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
                                                                                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
                                                                               Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.Window$Callback android.view.Window.getCallback()' on a null object reference
                                                                                  at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:120)
                                                                                  at android.support.v7.app.AppCompatDelegateImplV9.<init>(AppCompatDelegateImplV9.java:155)
                                                                                  at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:31)
                                                                                  at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:55)
                                                                                  at android.support.v7.app.AppCompatDelegateImplV23.<init>(AppCompatDelegateImplV23.java:33)
                                                                                  at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:203)
                                                                                  at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:185)
                                                                                  at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:519)
                                                                                  at android.support.v7.app.AppCompatActivity.findViewById(AppCompatActivity.java:190)
                                                                                  at com.example.android.justjava.MainActivity.<init>(MainActivity.java:23)
                                                                                  at java.lang.Class.newInstance(Native Method)
                                                                                  at android.app.Instrumentation.newActivity(Instrumentation.java:1096)
                                                                                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3123)
                                                                                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3416) 
                                                                                  at android.app.ActivityThread.access$1100(ActivityThread.java:230) 
                                                                                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1822) 
                                                                                  at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                  at android.os.Looper.loop(Looper.java:148) 
                                                                                  at android.app.ActivityThread.main(ActivityThread.java:7409) 
                                                                                  at java.lang.reflect.Method.invoke(Native Method) 
                                                                                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
                                                                                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 

我还是初学者,所以我真的不太了解,谢谢。

0 个答案:

没有答案