java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example/com.example.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.app.Activity.shouldShowRequestPermissionRationale(java.lang.String)' 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

,

Create an empty public constructor in your code.

Solutions on the web

via Stack Overflow by Kalpit
, 1 year ago
Unable to start activity ComponentInfo{com.example/com.example.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.app.Activity.shouldShowRequestPermissionRationale(java.lang.String)' on a null object reference
via Stack Overflow by Luca Kinateder
, 2 weeks ago
Unable to start activity ComponentInfo{com.example.kamran.logingreentheme/com.example.***.logingreentheme.SearchDatabase}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.RecyclerView.setHasFixedSize(boolean)' on a null object reference
via Stack Overflow by Akshay
, 1 year ago
Unable to start activity ComponentInfo{com.example/com.example.activity.Example}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.ViewTreeObserver android.view.View.getViewTreeObserver()' on a null object reference
via Stack Overflow by Mohammed Adel
, 10 months ago
Unable to start activity ComponentInfo{com.badr.said.muhammad.smarthome/com.badr.said.muhammad.smarthome.Welcome}: java.lang.NullPointerException: Attempt to invoke virtual method 'org.eclipse.paho.client.mqttv3.IMqttDeliveryToken org.eclipse.paho.android.service.MqttService.publish(java.lang.String, java.lang.String, byte[], int, boolean, java.lang.String, java.lang.String)' on a null object reference
via GitHub by sergiocastell
, 1 year ago
Unable to start activity ComponentInfo{rom.stalker/browser.afh.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.net.NetworkInfo.isConnectedOrConnecting()' on a null object reference
via GitHub by sergiocastell
, 1 year ago
Unable to start activity ComponentInfo{rom.stalker/browser.afh.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.net.NetworkInfo.isConnected()' on a null object reference
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example/com.example.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.app.Activity.shouldShowRequestPermissionRationale(java.lang.String)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2426)

Users with the same issue

66 times, 4 weeks ago
Once, 2 months ago
33 times, 3 months ago
8 times, 3 months ago
468 times, 4 months ago

Write tip

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