[expo-branch] [Android] Warning. Session initialization already happened.
See original GitHub issue🐛 Bug Report
Summary of Issue
When using the expo-branch on android it throws the following error when clicking on deep links if the app is already running in the background:
Error from Branch: Warning. Session initialization already happened. To force a new session, set intent extra, "branch_force_new_session", to true.
Sometimes also restarts / crashes the app.
Environment - output of expo diagnostics & the platform(s) you’re targeting
This is an android only problem.
Expo CLI 3.28.5 environment info: System: OS: macOS 10.15.7 Shell: 5.7.1 - /bin/zsh Binaries: Node: 14.6.0 - /usr/local/bin/node npm: 6.14.8 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 14.2, DriverKit 20.0, macOS 11.0, tvOS 14.2, watchOS 7.1 IDEs: Android Studio: 4.0 AI-193.6911.18.40.6626763 Xcode: 12.2/12B45b - /usr/bin/xcodebuild npmPackages: expo: ^39.0.3 => 39.0.4 react: 16.13.1 => 16.13.1 react-dom: 16.13.1 => 16.13.1 react-native: https://github.com/expo/react-native/archive/sdk-39.0.3.tar.gz => 0.63.2 react-native-web: ~0.13.7 => 0.13.18 react-navigation: ^4.4.1 => 4.4.3 npmGlobalPackages: expo-cli: 3.28.5 Expo Workflow: managed
Reproducible Demo
Hard to do in a snack as the expo-branch only works in standalone builds, it throws an error if I try and make a snack with it.
The error has already been identified in the original Branch React Native repository, see link here (https://github.com/BranchMetrics/react-native-branch-deep-linking-attribution/issues/572), and they have 2 potential solutions (one is to remove all reInitSession and other is to define SingleTask in AndroidManifest). I tried looking through the expo-branch package but I don’t know java so struggled to find a way to try this out / fix it.
Steps to Reproduce
- Start new expo project
- Install Branch and set it up
- Create a deep link and click on it while logging errors on Android
Expected Behavior vs Actual Behavior
The deep link should be handled by Branch without any crashing nor errors being thrown.
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (6 by maintainers)
Top Related StackOverflow Question
any update on this? I’m on expo 43 now and still facing this issue. The 44 just got released, and it does not seem there are any mentions of fixing this issue in the release notes – frustrating.
Bump