question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

getSupportFragmentManager() on a null object reference

See original GitHub issue

Bug report

Summary

Android crash Fatal Exception: java.lang.NullPointerException Attempt to invoke virtual method ‘getSupportFragmentManager()’ on a null object reference com.reactnative.community.viewpager2.adapter.FragmentStateAdapter.<init> (FragmentStateAdapter.java:103)

Environment info

react-native info output:

System:
    OS: macOS 10.15.4
    CPU: (8) x64 Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
    Memory: 49.84 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.2.0 - ~/.nvm/versions/node/v12.2.0/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.10.3 - ~/.nvm/versions/node/v12.2.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6392135
    Xcode: 11.4.1/11E503a - /usr/bin/xcodebuild
  npmPackages:
    react: 16.13.1 => 16.13.1 
    react-native: 0.61.5 => 0.61.5 
  npmGlobalPackages:
    react-native-cli: 2.0.1

Library version: 4.0.0

Steps to reproduce

Crash from Crashlytics

Describe what you expected to happen:

No crash

Reproducible sample code

(Common usage)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
teofanes-moreira-tiffin-foodscommented, Oct 18, 2020

@troZee any updates about that issue? some users getting this crash yet, all in background state. version "@react-native-community/viewpager": "4.1.6"

0reactions
arekkubaczkowskicommented, Jan 12, 2021

@ObidosDev I tried to reproduce it on 5.x version and couldn’t make appears this error. Could you please provide more details about it and check it on 5.x version as well?

Read more comments on GitHub >

github_iconTop Results From Across the Web

FragmentActivity.getSupportFragmentManager()' on a null ...
myContext is null, so when you call myContext.getSupportFragmentManager() you get a null pointer exception. An Activity is a Context so you ...
Read more >
FragmentActivity.getSupportFragmentManager - Java - Tabnine
Destroy all fragments and loaders. onResume. Dispatch onResume() to fragments. getPackageManager · startActivity · getPackageManager,; startActivity,; onStart, ...
Read more >
Fragment manager - Android Developers
Inside a fragment, you can get a reference to the FragmentManager that manages the fragment's children through getChildFragmentManager() .
Read more >
getsupportfragmentmanager
getsupportfragmentmanager on a null object reference ... myContext is null, so when you call myContext.getSupportFragmentManager() you get a null pointer ...
Read more >
Why is my fragment still null even though I added by the ...
In the first instance if manager.findFragmentById returns null then you create a new FragmentA object. But in the second case you do not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found