We recently integrated Firebase into our React Native Expo project, but now our build pipelines are failing during the CocoaPods installation step.
The error we’re encountering is:
[!] The following Swift pods cannot yet be integrated as static libraries:
The Swift podFirebaseCoreInternal
depends uponGoogleUtilities
, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may setuse_modular_headers!
globally in your Podfile, or specify:modular_headers => true
for particular dependencies.
To address this issue, we updated our app.json to include the following configuration:
{
"expo": {
"plugins": [
[
"expo-build-properties",
{
"ios": {
"useFrameworks": "static"
}
}
]
]
}
}
This works perfectly on local builds, but when running the build on our Azure pipeline, it fails with the same CocoaPods error.
We also tried adding these to our pod file but it does not seem to have any affect
pod 'Firebase/Analytics'
pod 'Firebase/Auth'
pod 'Firebase/Messaging'
pod 'GoogleUtilities', :modular_headers => true
Has anyone faced a similar issue, or does anyone have suggestions on how to resolve this for CI pipelines?
Any help would be greatly appreciated!
2
Answers
The root cause of the issue was an incorrect specification of the googleServicesFile in the app.json within our Azure environment. The error message we encountered was somewhat misleading and didn’t accurately reflect the actual problem.
Here’s the relevant configuration:
Recent versions of Firebase require Podfiles to include
use_frameworks!
oruse_frameworks! :linkage => :static
https://firebase.google.com/support/release-notes/ios#version_900_-_may_3_2022