[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

  1. Start new expo project
  2. Install Branch and set it up
  3. 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:open
  • Created 3 years ago
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
dmitryamecommented, Dec 20, 2021

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.

0reactions
Svartocommented, Nov 19, 2022

Bump

Read more comments on GitHub >

github_iconTop Results From Across the Web

Branch error Warning. Session initialization already happened.
This seems to be already addressed by the Branch team. There is no fix as of now, but you can try a workaround...
Read more >
Changes to Expo Branch support. We noticed that Android ...
We noticed that Android apps made with Expo are being removed by the Play Store because our Branch module is bundled in. To...
Read more >
Android Troubleshooting - Branch Help
The Branch Android SDK will automatically initialize when the app comes to the foreground, and the first activity to show enters the RESUMED...
Read more >
expo-gl-cpp | Yarn - Package Manager
This is the log of notable changes to the Expo client that are developer-facing. Package-specific changes not released in any SDK will be...
Read more >
CHANGELOG.md · 熊刚/Expo - Gitee.com
Expo 包含一组工具、库和服务,可以让你用 JavaScript 构建 Android 和 iOS 的原生 ... crashing an app when context initialization happens on remote JS context.
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