react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

[🐛] Expo 54/ @react-native-firebase/app: 23.5.0 is generating the wrong packageImportPath on android

Open valdioflorio opened this issue 3 months ago • 5 comments

Issue

When using expo with autogenerated folders I am getting the wrong packageImportPath for android.

Steps to reproduce

  • Create a react native expo project with the following configuration
  • run expo prebuild
  • run expo run:android
  • check the file android/build/generated/autolinking/autolinking.json
  • 🚨 Issue: packageImportPath": "import io.invertase.firebase.ReactNativeFirebaseAppPackage;"
  • Must be packageImportPath": "import io.invertase.firebase.app.ReactNativeFirebaseAppPackage;"

This I have confirmed with an older version of the dependency that was manually linked into the project. The current setup is a WIP migration from react-native bare-bone project into expo setup with "newArchEnabled": true

package.json

    "@react-native-firebase/app": "23.5.0",
    "@react-native-firebase/app-check": "23.5.0",
    "expo": "~54.0.21",
    "react-native": "0.81.5",
    "react": "19.1.0",

expo app.json

   "newArchEnabled": true,
 .....

      [
        "expo-build-properties",
        {
          "android": {
            "buildToolsVersion": "36.0.0",
            "compileSdkVersion": 36,
            "targetSdkVersion": 36,
            "minSdkVersion": 28,
          },
          "ios": {
            "useFrameworks": "static"
          }
        }

Android Crash

When running expo run:android the following error is visible in the build phase

android/app/build/generated/autolinking/src/main/java/com/facebook/react/PackageList.java:26: error: cannot find symbol
import io.invertase.firebase.ReactNativeFirebaseAppPackage;
                            ^
  symbol:   class ReactNativeFirebaseAppPackage
  location: package io.invertase.firebase

valdioflorio avatar Nov 18 '25 11:11 valdioflorio

If anyone else is facing the same issue a workaround for this is to enforce this to your projects react-native.config.js file

module.exports = {
  dependencies: {
    "@react-native-firebase/app": {
      platforms: {
        android: {
          packageImportPath: 'import io.invertase.firebase.app.ReactNativeFirebaseAppPackage;',   /* Add this line*/
        }
      }
    },
 
  },
  
};

valdioflorio avatar Nov 18 '25 12:11 valdioflorio

I am suspecting this issue could stem from a stale dependency that hasn't been updated hence why the workaround works as it forces us to not use that one. You could try:

Dedupe & reinstall:

rm -rf node_modules yarn.lock package-lock.json yarn install # or npm i

Verify autolinking:

npx react-native config

Ensure @react-native-firebase/app shows:

platforms.android.packageImportPath = "import io.invertase.firebase.app.ReactNativeFirebaseAppPackage;"

Regenerate native code:

expo prebuild --clean

let me know how this goes 😄

MichaelVerdon avatar Nov 19 '25 13:11 MichaelVerdon

with npx react-native config the packageImportPath seems to be displayed correctly but it is not applied as expected on android during build.

Very strange issue.

valdioflorio avatar Nov 19 '25 15:11 valdioflorio

with npx react-native config the packageImportPath seems to be displayed correctly but it is not applied as expected on android during build.

Very strange issue.

Thats also what makes me think its a stale cache issue, sometimes a good refresh of your dependencies should do the trick. 😄

MichaelVerdon avatar Nov 20 '25 09:11 MichaelVerdon

Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/MyPath/node_modules/@react-native-firebase/app/lib/common' is not supported resolving ES modules imported from /MyPath/node_modules/@react-native-firebase/analytics/lib/index.js Did you mean to import "@react-native-firebase/app/lib/common/index.js"?

"@react-native-firebase/analytics": "^23.7.0", "@react-native-firebase/app": "^23.7.0" "expo": "~53.0.22", "react": "19.0.0", "react-dom": "19.0.0",

the above error occurs when doing expo prebuild, how to fix it

enhbolorZB avatar Dec 09 '25 03:12 enhbolorZB