Reputation: 171
I am using eas build for my expo-based react native app. I am unable to build for ios and keep getting the error during Install pods with the following error log:
106 [!] The following Swift pods cannot yet be integrated as static libraries:
107 The Swift pod FirebaseCoreInternal
depends upon GoogleUtilities
, 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 set use_modular_headers!
globally in your Podfile, or specify :modular_headers => true
for particular dependencies.
108 Error: Unknown error. See logs for more information.
I have searched many stackoverflow related questions which I have used in editing the Podfile at node_modules/react-native/template/ios/Podfile. An excerpt of the Podfile is shown below:
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '12.4'
install! 'cocoapods', :deterministic_uuids => false
# added only these 5 lines to the Podfile
use_frameworks! :linkage => :static
pod 'Firebase', :modular_headers => true
pod 'FirebaseCoreInternal', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true
use_modular_headers!
target 'HelloWorld' do
config = use_native_modules!
# Flags change depending on the env values.
flags = get_default_flags()
...
Questions:
Are the added 5 lines in the appropriate place in the code? I have tried adding them just below the
Do I have to edit code elsewhere apart from the Podfile? If yes, where and what code.
Been battling this for up to 2 weeks now. Any help would be most welcome.
Thanks
Upvotes: 6
Views: 8329
Reputation: 71
[
"expo-build-properties",
{
"ios" :{
"deploymentTarget" : "13.4",
"useFrameworks" : "static"
}
}
]
I added this to my app.json. I got the deploymentTarget value from my podfile in ios/podfile From here-->
platform :ios, podfile_properties['ios.deploymentTarget'] || '13.4'
And then I ran eas build --platform ios
and the build the just passed.
Upvotes: 7
Reputation: 171
Searched and searched, and mixed and matched, and then trial and error. The following has worked for me.
In node_modules/react-native/template/ios/Podfile, i changed the Podfile to this
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '13.0'
install! 'cocoapods', :deterministic_uuids => false
target 'HelloWorld' do
config = use_native_modules!
# Flags change depending on the env values.
flags = get_default_flags()
pod 'Firebase', :modular_headers => true
pod 'FirebaseCore', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true
$RNFirebaseAsStaticFramework = true
use_react_native!(
:path => config[:reactNativePath],
# Hermes is now enabled by default. Disable by setting this flag to false.
# Upcoming versions of React Native may rely on get_default_flags(), but
# we make it explicit here to aid in the React Native upgrade process.
# :hermes_enabled => true,
:hermes_enabled => flags[:hermes_enabled],
:fabric_enabled => flags[:fabric_enabled],
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
# :flipper_configuration => FlipperConfiguration.enabled,
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
target 'HelloWorldTests' do
inherit! :complete
# Pods for testing
end
use_flipper!()
post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end
end
Then also added plugins to my app.config.js (similarly if you are using app.json).
module.exports = {
expo: {
name: "appName",
slug: "appName",
scheme: "appName",
version: "1.0.0",
orientation: "portrait",
icon: "./assets/icon_1.png",
userInterfaceStyle: "light",
splash: {
image: "./assets/entry_page.png",
resizeMode: "contain",
backgroundColor: "#ffffff"
},
updates: {
fallbackToCacheTimeout: 0
},
assetBundlePatterns: [
"**/*"
],
ios: {
supportsTablet: true,
bundleIdentifier: "com.myaooo.appName"
},
android: {
adaptiveIcon: {
foregroundImage: "./assets/icon_1.png",
backgroundColor: "#FFFFFF"
},
package: "com.myaooo.appName",
versionCode: 5,
config: {
googleMaps: {
apiKey: process.env.PLACES_API_KEY
}
}
},
web: {
favicon: "./assets/favicon.png"
},
extra: {
eas: {
placesApiKey: process.env.PLACES_API_KEY,
youtTubeApiKey: process.env.YOUTUBE_API_KEY,
webApiKey: process.env.WEB_API_KEY,
firebaseApiKey: process.env.apiKey,
expoGoogleClientId: process.env.EXPO_GO_GOOGLE_CONSOLE_client_id,
expoAndroidId: process.env.EXPO_GO_GOOGLE_CONSOLE_androidClientId,
expoIosId: process.env.EXPO_GO_GOOGLE_CONSOLE_iosClientId,
clientID: process.env.WEB_clientId,
expoGoogleClientSecret: process.env.EXPO_GO_GOOGLE_CONSOLE_client_secret
}
},
plugins: [
[
"expo-build-properties",
{
android: {
compileSdkVersion:31,
targetSdkVersion:31,
buildToolsVersion:"31.0.0"
},
ios: {
deploymentTarget:"13.0",
useFrameworks: "static"
}
}
]
]
}
}
In essence you have to make modifications on the podfile (add the modular headers) and also on the app.json / app.config.js (add the plugins) files.
Upvotes: 5