java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' 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

Solutions on the web

via GitHub by samueltardieu
, 1 year ago
Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference
via Stack Overflow by Aaron
, 1 year ago
Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
via Stack Overflow by bob
, 1 year ago
Attempt to invoke interface method 'java.lang.Object com.facebook.inject.Lazy.get()' on a null object reference
via GitHub by 3asm
, 1 year ago
Attempt to invoke interface method 'void android.database.Cursor.setNotificationUri(android.content.ContentResolver, android.net.Uri)' on a null object reference
via Stack Overflow by Jemshit Iskenderov
, 2 years ago
Null pointer exception during instruction 'invoke-static {v0}, android.os.IBinder android.media.AudioService$VolumeStreamState$VolumeDeathHandler.access$5300(android.media.AudioService$VolumeStreamState$VolumeDeathHandler) // method@11492'
via databasefaq.com by Unknown author, 1 year ago
Null pointer exception during instruction 'invoke-static {v0}, android.os.IBinder android.media.AudioService$VolumeStreamState$VolumeDeathHandler.access$5300(android.media.AudioService$VolumeStreamState$VolumeDeathHandler) // '
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference
at android.os.Parcel.readException(Parcel.java:1626)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
at android.content.ContentProviderProxy.query(ContentProviderNative.java:421)
at android.content.ContentResolver.query(ContentResolver.java:493)
at android.content.ContentResolver.query(ContentResolver.java:435)
at locus.api.android.ActionTools.getLocusInfo(ActionTools.java:854)
at locus.api.android.utils.LocusUtils.getActiveVersion(LocusUtils.java:321)
at locus.api.android.utils.LocusUtils.getActiveVersion(LocusUtils.java:293)
at cgeo.geocaching.apps.AbstractLocusApp.isInstalled(AbstractLocusApp.java:48)
at cgeo.geocaching.apps.navi.NavigationAppFactory.getInstalledNavigationApps(NavigationAppFactory.java:206)
at cgeo.geocaching.apps.navi.NavigationAppFactory.getNavigationAppForId(NavigationAppFactory.java:344)
at cgeo.geocaching.apps.navi.NavigationAppFactory.getDefaultNavigationApplication(NavigationAppFactory.java:304)
at cgeo.geocaching.apps.navi.NavigationAppFactory.getDefaultNavigationApplication(NavigationAppFactory.java:339)
at cgeo.geocaching.CacheMenuHandler.onPrepareOptionsMenu(CacheMenuHandler.java:99)
at cgeo.geocaching.CacheMenuHandler.addMenuItems(CacheMenuHandler.java:112)
at cgeo.geocaching.CacheMenuHandler.addMenuItems(CacheMenuHandler.java:116)
at cgeo.geocaching.CacheDetailActivity.onCreateOptionsMenu(CacheDetailActivity.java:570)
at android.support.v7.app.ActionBarActivity.superOnCreatePanelMenu(ActionBarActivity.java:233)
at android.support.v7.app.ActionBarActivityDelegateICS.onCreatePanelMenu(ActionBarActivityDelegateICS.java:146)
at android.support.v7.app.ActionBarActivity.onCreatePanelMenu(ActionBarActivity.java:200)
at com.android.internal.policy.PhoneWindow.preparePanel(PhoneWindow.java:617)
at com.android.internal.policy.PhoneWindow.doInvalidatePanelMenu(PhoneWindow.java:989)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
at android.view.Choreographer.doCallbacks(Choreographer.java:670)
at android.view.Choreographer.doFrame(Choreographer.java:603)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5461)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)

Users with the same issue

10 times, 4 months ago
2 times, 6 months ago
2 times, 6 months ago
2 times, 7 months ago
611 times, 10 months ago

Write tip

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