getSupportFragmentManager() on a null object reference
See original GitHub issueBug 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:
- Created 3 years ago
- Reactions:2
- Comments:11 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@troZee any updates about that issue? some users getting this crash yet, all in background state. version
"@react-native-community/viewpager": "4.1.6"
@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?