-4

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: JAVA MainActivity

  • 2
    You should really post the code and logcat in text, not a screenshot. The most important parts of the stack trace are the first and long lines that the screenshot truncates. – Paulo Avelar Aug 04 '17 at 16:42
  • Please see: [How do I avoid misusing tags?](https://meta.stackoverflow.com/questions/354427/how-do-i-avoid-misusing-tags) Also, images are useless to us - please see [this](https://meta.stackoverflow.com/a/285557/4032703) for a list of the many reasons why you shouldn't upload code as images. – EJoshuaS - Stand with Ukraine Aug 04 '17 at 18:27

1 Answers1

0

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.