Error: "You attempted to use a firebase module not installed on your Android project" when using @react-native-firebase/dynamic-links in expo app

Please provide the following:

  1. SDK Version:46.0.0
  2. Platforms(Android/iOS/web/all): all
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

I am trying to implement dynamic linking in my Expo app using @react-native-firebase/dynamic-links. However, I am encountering an error and need assistance resolving it.

Code snippet:

const handleDynamicLink = (link: any) => {
  console.log(link);
  // Handle dynamic link inside your own application
};

useEffect(() => {
  const unsubscribe = dynamicLinks().onLink(handleDynamicLink);
  return () => unsubscribe(); // Remove the listener when the component is unmounted
}, []);

useEffect(() => {
  dynamicLinks()
    .getInitialLink()
    .then((link: any) => {
      console.log(link);
      // Perform additional actions based on the initial link
    });
}, []);

Error message:
“Error: You attempted to use a firebase module that’s not installed on your Android project by calling firebase.app(). Ensure you have imported the ‘io.invertase.firebase.app.ReactNativeFirebaseAppPackage’ module in your ‘MainApplication.java’ file and added the ‘new ReactNativeFirebaseAppPackage()’ line inside the RN ‘getPackages()’ method list.”

I am aware that using react-native-firebase directly in an Expo app is not supported, but I would like to know how to make the dynamicLinks component work in my Expo app.

Hi, try creating a development build with expo and check out if it works, firebase does not work inside of expo go.

1 Like

So, I have to comment out that piece of code every time i am in development environment?

Hi @retemember

No. You have two options:
1.) Still use Expo Go for development, but avoid calling the native code in Expo Go. e.g. Runtime detection
2.) Or, as @sandor147 suggested, you can create a development build to use instead of Expo Go. This is basically a custom version of Expo Go with all of your dependencies built in.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.