java.lang.RuntimeException: Unable to start activity ComponentInfo{rishabh.example.com.navigationdrawer/rishabh.example.com.navigationdrawer.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.LinearLayout.addView(android.view.View)' on a null object reference

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Samebug tips

Do you know how to solve this issue? Write a tip to help other users and build your expert profile.

Solutions on the web

via Stack Overflow by R.K. GUPTA
, 1 year ago
Unable to start activity ComponentInfo{rishabh.example.com.navigationdrawer/rishabh.example.com.navigationdrawer.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.LinearLayout.addView(android.view.View)' on a null object reference
via Stack Overflow by Shailender Narang
, 1 year ago
Unable to start activity ComponentInfo{}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ImageView.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
via GitHub by DHGHH
, 1 year ago
Unable to start activity ComponentInfo{com.bbk.app.main/com.bbk.hh.app.mine.MineActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
via GitHub by bl4d3
, 2 years ago
Unable to start activity ComponentInfo{com.yydigital.tishadowapp/com.yydigital.tishadowapp.TishadowActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.app.ActionBarActivityDelegate.setContentView(android.view.View)' on a null object reference
via Stack Overflow by carlos1990
, 2 years ago
Unable to start activity ComponentInfo{com.cm.georganizer/com.cm.georganizer.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
via Stack Overflow by Unknown author, 2 years ago
Unable to start activity ComponentInfo{com.example.barun.myapplication/com.example.barun.myapplication.TextPlay}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
java.lang.RuntimeException: Unable to start activity ComponentInfo{rishabh.example.com.navigationdrawer/rishabh.example.com.navigationdrawer.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.LinearLayout.addView(android.view.View)' on a null object reference
at rishabh.example.com.navigationdrawer.MainActivity.onCreate(MainActivity.java:58)
at android.app.Activity.performCreate(Activity.java:6010)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1129)

Users with the same issue

You are the first who have seen this exception. Write a tip to help other users and build your expert profile.

Write tip

Know the solutions? Share your knowledge to help other developers to debug faster.