This question already has an answer here:
What is a NullPointerException, and how do I fix it?
I am creating a simple static application in android studio. When I tried to run the application using USB debugging option, It crashed and showed two errors in logcat:
Screenshot of logcat
I am new to android studio and it is my first project, please help me in debugging this error.
Here is the screenshot for the MainActivity Java code where the error is supposed to be:
It is only one error. You have an NPE in MainActivity line 39, that error has caused the RuntimeException. It looks like button is null for some reason. Maybe your button (R.id.button) is not actually declared in R.layout.activity_main.