java.lang.RuntimeException: Unable to start activity ComponentInfo{com.afwsamples.testdpc/com.afwsamples.testdpc.PolicyManagementActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.preference.Preference.setOnPreferenceChangeListener(android.support.v7.preference.Preference$OnPreferenceChangeListener)' 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 GitHub by guanhuay
, 1 year ago
Unable to start activity ComponentInfo{com.afwsamples.testdpc/com.afwsamples.testdpc.PolicyManagementActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.preference.Preference.setOnPreferenceChangeListener(android.support.v7.preference.Preference$OnPreferenceChangeListener)' on a null object reference
via GitHub by gubatron
, 11 months ago
Unable to start activity ComponentInfo{com.frostwire.android/com.frostwire.android.gui.activities.SettingsActivity2}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.preference.SwitchPreferenceCompat.setOnPreferenceChangeListener(android.support.v7.preference.Preference$OnPreferenceChangeListener)' on a null object reference
via Stack Overflow by HIREN DIXIT
, 1 month ago
Unable to start activity ComponentInfo{}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.Toolbar.setNavigationIcon(int)' on a null object reference
via GitHub by hanfeng1982
, 4 months ago
Unable to start activity ComponentInfo{******Activity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.RecyclerView.setLayoutManager(android.support.v7.widget.RecyclerView$LayoutManager)' on a null object reference
via Stack Overflow by Ivan Bošnjaković
, 2 years ago
Unable to start activity ComponentInfo{com.bosnjakovic.ivan.criminalintent/com.bosnjakovic.ivan.criminalintent.CrimeListActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.RecyclerView.setLayoutManager(android.support.v7.widget.RecyclerView$LayoutManager)' on a null object reference
via Stack Overflow by Bertho Joris
, 1 year ago
Unable to start activity ComponentInfo{com.transvision.bertho.transvisiondashboardapp/com.transvision.bertho.transvisiondashboardapp.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.RecyclerView.setLayoutManager(android.support.v7.widget.RecyclerView$LayoutManager)' on a null object reference
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.afwsamples.testdpc/com.afwsamples.testdpc.PolicyManagementActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.preference.Preference.setOnPreferenceChangeListener(android.support.v7.preference.Preference$OnPreferenceChangeListener)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)

Users with the same issue

66 times, 3 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.