question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Web browser already open or No matching activity - React Native Android Social Authentication

See original GitHub issue

✅ Prerequisites

  • Did you perform a cursory search of open issues? Is this bug already reported elsewhere? No open issues
  • Are you running the latest SDK version? Yes
  • Are you reporting to the correct repository (magic-sdk)? Yes

🐛 Description

My RN project is built with React Native CLI (Not expo) and I had to install unimodules to make support for the magic link library. In iOS, all works fine but I got a weird error when I do the social authenticate in android.

🧩 Steps to Reproduce

When the user tries to do the social authenticate in RN android.

🤔 Expected behavior

Social authentication popup should have appeared for the relevant domains (google, Facebook, etc.)

😮 Actual behavior

I am getting this error when I try to authenticate for the first time. __ alt text

This error occurs when I try to attempt more than once. __ alt text

💻 Code Sample

import {Magic} from '@magic-sdk/react-native';
import {OAuthExtension} from '@magic-ext/react-native-oauth';

const magic = new Magic('API_KEY', {
  extensions: [new OAuthExtension()],
});

await magic.oauth.loginWithPopup({
      provider: 'google',
      redirectURI: 'quantappfinance://quantapp` // Android Deep Linking URL
});

🌎 Environment

Software Version(s)
@magic-sdk/react-native 4.3.1
@magic-ext/react-native-oauth 0.3.0
React Native 0.64.0
Node version 12.19
Browser RN Webview
yarn 1.9.2
Operating System Android

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
mattwebhubcommented, Jan 10, 2022

@Ethella package.json:

{
  "name": "",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint . --ext .ts,.tsx",
  },
  "dependencies": {
    "@bugsnag/react-native": "^7.14.1",
    "@datadog/mobile-react-native": "^1.0.0-rc2",
    "@datadog/mobile-react-native-navigation": "^1.0.0-rc2",
    "@magic-ext/react-native-oauth": "^0.4.0",
    "@magic-sdk/react-native": "^4.4.2",
    "@react-native-async-storage/async-storage": "^1.15.5",
    "@rematch/core": "^2.0.1",
    "@rematch/immer": "^2.0.1",
    "@rematch/loading": "^2.0.1",
    "@rematch/persist": "^2.0.1",
    "@rematch/select": "^3.0.1",
    "@rematch/updated": "^2.0.1",
    "@unimodules/core": "7.1.2",
    "@unimodules/react-native-adapter": "6.3.9",
    "axios": "^0.24.0",
    "babel-plugin-module-resolver": "^4.1.0",
    "dayjs": "^1.10.3",
    "expo": "44.0.4",
    "expo-web-browser": "^10.1.0",
    "graphql": "^16.0.1",
    "graphql-request": "^3.6.1",
    "i18n-js": "^3.8.0",
    "immer": "^9.0.5",
    "lodash": "^4.17.20",
    "magic-sdk": "^4.4.2",
    "prettier": "^2.3.2",
    "react": "17.0.2",
    "react-hook-form": "^7.13.0",
    "react-native": "0.66.4",
    "react-native-animatable": "^1.3.3",
    "react-native-config": "^1.4.4",
    "react-native-dark-mode": "^0.2.2",
    "react-native-fs": "^2.18.0",
    "react-native-gesture-handler": "^1.10.3",
    "react-native-image-resizer": "^1.4.5",
    "react-native-localize": "^2.1.4",
    "react-native-navigation": "^7.18.1",
    "react-native-reanimated": "2.2.4",
    "react-native-safe-area-view": "^1.1.1",
    "react-native-splash-screen": "^3.2.0",
    "react-native-textinput-effects": "^0.6.2",
    "react-native-webview": "^11.14.0",
    "react-query": "^3.28.0",
    "react-redux": "^7.2.4",
    "redux": "^4.1.0",
    "redux-logger": "^3.0.6",
    "validate.js": "^0.13.1"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@bugsnag/source-maps": "^2.3.0",
    "@react-native-community/eslint-config": "^2.0.0",
    "@testing-library/jest-native": "^4.0.2",
    "@testing-library/react-native": "^8.0.0",
    "@types/enzyme": "^3.10.10",
    "@types/i18n-js": "^3.8.2",
    "@types/jest": "^26.0.23",
    "@types/react-native": "^0.64.5",
    "@types/react-test-renderer": "^16.9.2",
    "@types/redux-logger": "^3.0.9",
    "babel-jest": "^26.6.3",
    "babel-plugin-transform-inline-environment-variables": "^0.4.3",
    "eslint": "^7.14.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-import-resolver-typescript": "^2.5.0",
    "eslint-plugin-import": "^2.25.3",
    "eslint-plugin-prettier": "^4.0.0",
    "eslint-plugin-react": "^7.27.0",
    "eslint-plugin-react-hooks": "^4.3.0",
    "eslint-plugin-react-native": "^3.11.0",
    "eslint-plugin-unused-imports": "^2.0.0",
    "husky": "^7.0.4",
    "jest": "^26.6.3",
    "jest-enzyme": "^7.1.2",
    "lint-staged": "^11.2.6",
    "metro-react-native-babel-preset": "^0.66.2",
    "react-dom": "^17.0.2",
    "react-native-codegen": "^0.0.7",
    "react-test-renderer": "17.0.2",
    "typescript": "4.1.3"
  },
  "resolutions": {
    "@types/react": "^17"
  },
  "lint-staged": {
    "*.{js,jsx,ts,tsx}": [
      "prettier --write",
      "eslint --fix"
    ]
  },
  "expo": {
    "autolinking": {
      "exclude": [
        "expo-file-system"
      ]
    }
  }
}

So the steps I did were to: 1- Remove unimodules and magic 2- Add expo@44.0.4 2.1- I did some manual installation on MainApplication.java as automatic linking is not supported with react-native-navigation 3- Build successful 4- Add:
-@unimodules/core@7.1.2 -@unimodules/react-native-adapter@6.3.9 5- Build fails asking for unimodules-app-loader 6- Add: @unimodules-app-loader@3.0.0 7- Build fails with error:

AndroidManifest.xml:12:13-88 Error:
        Attribute meta-data#org.unimodules.core.AppLoader#react-native-headless@value value=(org.unimodules.adapters.react.apploader.RNHeadlessAppLoader) from [:unimodules_react-native-adapter] AndroidManifest.xml:12:13-88
        is also present at [:expo-modules-core] AndroidManifest.xml:12:13-86 value=(expo.modules.adapters.react.apploader.RNHeadlessAppLoader).
        Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:10:9-12:91 to override.

So apparently there’s some conflicts with unimodules and expo. Maybe you guys will have to upgrade to expo as well instead of react-native-unimodules?

After following steps in https://stackoverflow.com/questions/69810291/react-native-gradle-manifest-merge-error, I pass over this issue but now getting other issues with permissions apparently:

e: {hidden}/node_modules/@unimodules/react-native-adapter/android/src/main/java/org/unimodules/adapters/react/apploader/RNHeadlessAppLoader.kt: (6, 33): Unresolved reference: HeadlessAppLoader
e: {hidden}/node_modules/@unimodules/react-native-adapter/android/src/main/java/org/unimodules/adapters/react/apploader/RNHeadlessAppLoader.kt: (12, 83): Unresolved reference: HeadlessAppLoader
e: {hidden}/node_modules/@unimodules/react-native-adapter/android/src/main/java/org/unimodules/adapters/react/apploader/RNHeadlessAppLoader.kt: (16, 3): 'loadApp' overrides nothing
e: {hidden}/node_modules/@unimodules/react-native-adapter/android/src/main/java/org/unimodules/adapters/react/apploader/RNHeadlessAppLoader.kt: (16, 50): Unresolved reference: HeadlessAppLoader
e: {hidden}/node_modules/@unimodules/react-native-adapter/android/src/main/java/org/unimodules/adapters/react/apploader/RNHeadlessAppLoader.kt: (42, 3): 'invalidateApp' overrides nothing
e: {hidden}/node_modules/@unimodules/react-native-adapter/android/src/main/java/org/unimodules/adapters/react/apploader/RNHeadlessAppLoader.kt: (56, 3): 'isRunning' overrides nothing
e: {hidden}/node_modules/@unimodules/react-native-adapter/android/src/main/java/org/unimodules/adapters/react/permissions/PermissionsService.kt: (33, 6): Class 'PermissionsService' is not abstract and does not implement abstract member public abstract fun getPermissionsWithPromise(promise: Promise!, vararg permissions: String!): Unit defined in expo.modules.interfaces.permissions.Permissions
e: {hidden}/node_modules/@unimodules/react-native-adapter/android/src/main/java/org/unimodules/adapters/react/permissions/PermissionsService.kt: (65, 3): 'getPermissionsWithPromise' overrides nothing
e: {hidden}/node_modules/@unimodules/react-native-adapter/android/src/main/java/org/unimodules/adapters/react/permissions/PermissionsService.kt: (84, 3): 'askForPermissionsWithPromise' overrides nothing
2reactions
Ethellacommented, Dec 10, 2021

It doesn’t look like there’s a solution right now. And other alternative packages are out-of-date. I’ll chat with the team to see if it’s possible to address a temporary solution to get around usage of expo-web-browser

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't use WebBrowser in Android on SDK 30+ - Reddit
Basically, WebBrowser is throwing an error with no matching activity in SDK 30+, and then just failing to launch after that.
Read more >
No matching activity error in React Native/Expo on Android
I have a React Native/Expo app, and since migrating to Android SDK 30, I have been receiving several "no matching activity errors", ...
Read more >
Authentication - Expo Documentation
Authentication. Expo can be used to login to many popular providers on iOS, Android, and web! Most of these guides utilize the pure...
Read more >
Create a React Native App with Login in 10 Minutes
You will need to run an AVD (Android Virtual Device) before starting your app, or you can plug in your Android phone and...
Read more >
react-native-inappbrowser-reborn - npm
Android · Add import com.proyecto26.inappbrowser.RNInAppBrowserPackage; to the imports at the top of the file · Add new RNInAppBrowserPackage() to ...
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