Recent increase in 'No matching activity' errors from `WebBrowser.openBrowserAsync()`
Problem
Summary An app in production since August 2020 that launches a web browser using `WebBrowser.openBrowserAsync()` is failing to do so without throwing 'No matching activity' errors on some Android devices, but with an increasing frequency during 2021 so far. It seems to be mostly affecting devices running Android 11 (a full list of device models is available). 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) _No response_ Environment Expo CLI 3.28.5 environment info: System: OS: macOS 10.15.7 Shell: 5.7.1 - /bin/zsh Binaries: Node: 12.19.0 - /usr/local/bin/node npm: 6.14.11 - /usr/local/bin/npm Managers: CocoaPods: 1.10.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2 IDEs: Xcode: 12.4/12D4e - /usr/bin/xcodebuild npmPackages: expo: ^37.0.0 => 37.0.12 react: 16.9.0 => 16.9.0 react-dom: 16.9.0 => 16.9.0 react-native: 0.61.4 => 0.61.4 react-native-web: ^0.11.7 => 0.11.7 react-navigation: ^4.0.10 => 4.4.0 npmGlobalPackages: expo-cli: 3.28.5 Expo Workflow: bare Reproducible demo or steps to reproduce from a blank project [code block] The issue above is occurring with increasing frequency on an app in production on Expo 37. I am aware of `We
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Update WebBrowser Implementation for Android 11 Compatibility
The 'No matching activity' error occurs when the WebBrowser module cannot find an appropriate activity to handle the intent for opening a URL. This issue has become more prevalent with Android 11 due to changes in how intents are handled and the requirement for specific permissions. The app may not have the necessary intent filters or permissions set up correctly in the AndroidManifest.xml file, leading to this error on certain devices.
Awaiting Verification
Be the first to verify this fix
- 1
Check and Update AndroidManifest.xml
Ensure that the AndroidManifest.xml file includes the necessary intent filters for handling web URLs. Add the following intent filter within the <activity> tag of your main activity.
xml<intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="http" /> <data android:scheme="https" /> </intent-filter> - 2
Request Necessary Permissions
Ensure that your app has the necessary permissions to access the internet. Add the following permission to your AndroidManifest.xml file if it is not already present.
xml<uses-permission android:name="android.permission.INTERNET" /> - 3
Update Expo SDK Version
Consider updating your Expo SDK version to a more recent version that may have addressed compatibility issues with Android 11. This can be done by updating the expo package in your package.json and running npm install.
bashnpm install expo@latest - 4
Test on Affected Devices
After making the above changes, test the app on the specific Android devices that were previously experiencing the 'No matching activity' error to confirm that the issue has been resolved.
bashRun the app on Android 11 devices and attempt to open a web browser using WebBrowser.openBrowserAsync()
Validation
Confirm that the app can successfully open URLs in the web browser without throwing the 'No matching activity' error on Android 11 devices. Monitor user feedback and error logs for any recurrence of the issue.
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep