expo: Current activity not found. Make sure to call this method while your application is in foreground.
Summary
Using expo-splash-screen and SplashScreen.preventAutoHideAsync() throws many errors in production builds.
I call preventAutoHideAsync first thing in App.js. The error message is Current activity not found. Make sure to call this method while your application is in foreground..
Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!
bare
What platform(s) does this occur on?
Android
SDK Version (managed workflow only)
42.0.5
Environment
Expo CLI 4.7.3 environment info: System: OS: macOS 11.5.1 Shell: 5.8 - /bin/zsh Binaries: Node: 16.9.1 - /opt/homebrew/bin/node Yarn: 1.22.11 - /opt/homebrew/bin/yarn npm: 7.21.1 - /opt/homebrew/bin/npm Watchman: 2021.09.13.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.2 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4 Android SDK: API Levels: 28, 29, 30 Build Tools: 28.0.3, 29.0.2, 29.0.3, 30.0.2, 30.0.3, 31.0.0, 31.0.0 System Images: android-28 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-30 | Google APIs ARM 64 v8a, android-30 | Google APIs Intel x86 Atom, android-30 | Google Play ARM 64 v8a, android-30 | Google Play Intel x86 Atom, android-S | Google Play ARM 64 v8a Android NDK: 20.1.5948944 IDEs: Android Studio: 4.2 AI-202.7660.26.42.7486908 Xcode: 12.5.1/12E507 - /usr/bin/xcodebuild npmPackages: expo: ^42.0.5 => 42.0.5 react: 17.0.1 => 17.0.1 react-native: 0.64.2 => 0.64.2 Expo Workflow: bare
Reproducible demo or steps to reproduce from a blank project
SplashScreen.preventAutoHideAsync()
.then(() => console.log(`SplashScreen.preventAutoHideAsync() succeeded`))
.catch(e => Bugsnag.notify(e))
Called first thing in App.js
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 3
- Comments: 15 (5 by maintainers)
I am using expo SDK 44 (managed workflow) and still getting this error. Any solution yet ?
Here’s my
package.jsondependencies:Yeap. It is happening in SDK 46, managed.