java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference

Stack Overflow | Manvendra Sah | 4 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    NullPointerException while using dagger-2 to inject preferences in fragment

    Stack Overflow | 4 months ago | Manvendra Sah
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference
  2. 0

    Won't work when user will change security code/schema...

    GitHub | 2 years ago | ghost
    java.lang.RuntimeException: Unable to start activity ComponentInfo{in.co.ophio.secure.sample/in.co.ophio.secure.sample.view.MainActivity}: java.lang.IllegalStateException: java.security.InvalidKeyException: javax.crypto.BadPaddingException: error:0407106B:rsa routines:RSA_padding_check_PKCS1_type_2:block type is not 02
  3. 0

    GitHub comment 5#283935714

    GitHub | 3 months ago | joen93
    java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/safeparcel/AbstractSafeParcelable;
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    StrictMode violation

    GitHub | 3 months ago | maturecheese
    android.os.StrictMode$StrictModeDiskReadViolation: policy=95 violation=2
  6. 0

    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference

    GitHub | 1 year ago | galadril
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference

  1. Indri Yunita 4 times, last 5 months ago
  2. ivotje50 2 times, last 11 months ago
  3. joni1408 1 times, last 12 months ago
  4. Mihail Melnic 2 times, last 12 months ago
  5. asvid 209 times, last 1 year ago
4 more registered users
4 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.NullPointerException

    Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference

    at android.content.ContextWrapper.getPackageName()
  2. Android Platform
    PreferenceManager.getDefaultSharedPreferences
    1. android.content.ContextWrapper.getPackageName(ContextWrapper.java:133)
    2. android.preference.PreferenceManager.getDefaultSharedPreferencesName(PreferenceManager.java:390)
    3. android.preference.PreferenceManager.getDefaultSharedPreferences(PreferenceManager.java:385)
    3 frames
  3. dagger.module
    AppModule_ProvidesSharedPreferenceFactory.get
    1. dagger.module.AppModule.providesSharedPreference(AppModule.java:34)
    2. dagger.module.AppModule_ProvidesSharedPreferenceFactory.get(AppModule_ProvidesSharedPreferenceFactory.java:23)
    3. dagger.module.AppModule_ProvidesSharedPreferenceFactory.get(AppModule_ProvidesSharedPreferenceFactory.java:8)
    3 frames
  4. Dagger
    ScopedProvider.get
    1. dagger.internal.ScopedProvider.get(ScopedProvider.java:47)
    1 frame
  5. ui
    DisplayFragment_MembersInjector.injectMembers
    1. ui.DisplayFragment_MembersInjector.injectMembers(DisplayFragment_MembersInjector.java:29)
    2. ui.DisplayFragment_MembersInjector.injectMembers(DisplayFragment_MembersInjector.java:8)
    2 frames
  6. dagger.component
    DaggerAppComponent.inject
    1. dagger.component.DaggerAppComponent.inject(DaggerAppComponent.java:45)
    1 frame
  7. ui
    MainActivity$MyPagerAdapter.getItem
    1. ui.DisplayFragment.<init>(DisplayFragment.java:37)
    2. ui.DisplayFragment.newInstance(DisplayFragment.java:41)
    3. ui.MainActivity$MyPagerAdapter.getItem(MainActivity.java:86)
    3 frames
  8. Android Support v4
    ViewPager.onMeasure
    1. android.support.v4.app.FragmentPagerAdapter.instantiateItem(FragmentPagerAdapter.java:101)
    2. android.support.v4.view.ViewPager.addNewItem(ViewPager.java:1034)
    3. android.support.v4.view.ViewPager.populate(ViewPager.java:1182)
    4. android.support.v4.view.ViewPager.populate(ViewPager.java:1116)
    5. android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1642)
    5 frames
  9. Android Platform
    FrameLayout.onMeasure
    1. android.view.View.measure(View.java:19324)
    2. android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:825)
    3. android.widget.RelativeLayout.onMeasure(RelativeLayout.java:511)
    4. android.view.View.measure(View.java:19324)
    5. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6113)
    6. android.widget.FrameLayout.onMeasure(FrameLayout.java:223)
    6 frames
  10. Android v7
    ContentFrameLayout.onMeasure
    1. android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139)
    1 frame
  11. Android Platform
    ViewGroup.measureChildWithMargins
    1. android.view.View.measure(View.java:19324)
    2. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6113)
    2 frames
  12. Android v7
    ActionBarOverlayLayout.onMeasure
    1. android.support.v7.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:393)
    1 frame
  13. Android Platform
    FrameLayout.onMeasure
    1. android.view.View.measure(View.java:19324)
    2. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6113)
    3. android.widget.FrameLayout.onMeasure(FrameLayout.java:223)
    4. android.view.View.measure(View.java:19324)
    5. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6113)
    6. android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1723)
    7. android.widget.LinearLayout.measureVertical(LinearLayout.java:788)
    8. android.widget.LinearLayout.onMeasure(LinearLayout.java:648)
    9. android.view.View.measure(View.java:19324)
    10. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6113)
    11. android.widget.FrameLayout.onMeasure(FrameLayout.java:223)
    11 frames
  14. Android
    PhoneWindow$DecorView.onMeasure
    1. com.android.internal.policy.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2694)
    1 frame
  15. Android Platform
    ActivityThread.main
    1. android.view.View.measure(View.java:19324)
    2. android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2545)
    3. android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1454)
    4. android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1709)
    5. android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1335)
    6. android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6816)
    7. android.view.Choreographer$CallbackRecord.run(Choreographer.java:894)
    8. android.view.Choreographer.doCallbacks(Choreographer.java:696)
    9. android.view.Choreographer.doFrame(Choreographer.java:631)
    10. android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:880)
    11. android.os.Handler.handleCallback(Handler.java:815)
    12. android.os.Handler.dispatchMessage(Handler.java:104)
    13. android.os.Looper.loop(Looper.java:207)
    14. android.app.ActivityThread.main(ActivityThread.java:5896)
    14 frames