[🐛] Expo 54/ @react-native-firebase/app: 23.5.0 is generating the wrong packageImportPath on android
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
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*/
}
}
},
},
};
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 😄
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.
with
npx react-native configthepackageImportPathseems 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. 😄
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