[🐛] Adding "$RNFirebaseAnalyticsWithoutAdIdSupport=true" in Podfile results in "Multiple commands produce..." error for React Native Firebase Analytics
I'm on a expo managed workflow and using a custom config plugin to add this entry to my podfile:
$RNFirebaseAnalyticsWithoutAdIdSupport=true
and it results in failed builds:
❌ error: Multiple commands produce '/Users/expo/Library/Developer/Xcode/DerivedData/MobileCatApp-bsjslklzyupcrvhhcalhmhcawlyq/Build/Intermediates.noindex/ArchiveIntermediates/MobileCatApp/BuildProductsPath/Debug-iphoneos/XCFrameworkIntermediates/FirebaseAnalytics/AdIdSupport/FirebaseAnalytics.framework'
duplicate output file '/Users/expo/Library/Developer/Xcode/DerivedData/MobileCatApp-bsjslklzyupcrvhhcalhmhcawlyq/Build/Intermediates.noindex/ArchiveIntermediates/MobileCatApp/BuildProductsPath/Debug-iphoneos/XCFrameworkIntermediates/FirebaseAnalytics/AdIdSupport/FirebaseAnalytics.framework' on task: PhaseScriptExecution [CP] Copy XCFrameworks /Users/expo/Library/Developer/Xcode/DerivedData/MobileCatApp-bsjslklzyupcrvhhcalhmhcawlyq/Build/Intermediates.noindex/ArchiveIntermediates/MobileCatApp/IntermediateBuildFilesPath/Pods.build/Debug-iphoneos/FirebaseAnalytics.default-WithoutAdIdSupport.build/Script-46EB2E00022700.sh (in target 'FirebaseAnalytics.default-WithoutAdIdSupport' from project 'Pods')
▸ ** ARCHIVE FAILED **
2022-08-06 02:30:06.829 xcodebuild[4533:14187] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-08-06 02:30:06.829 xcodebuild[4533:14187] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-08-06 02:30:06.888 xcodebuild[4533:14187] XType: failed to connect - Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.fonts was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.fonts was invalidated: failed at lookup with error 3 - No such process.}
2022-08-06 02:30:06.888 xcodebuild[4533:14187] Font server protocol version mismatch (expected:5 got:0), falling back to local fonts
2022-08-06 02:30:06.888 xcodebuild[4533:14187] XType: unable to make a connection to the font daemon!
2022-08-06 02:30:06.888 xcodebuild[4533:14187] XType: XTFontStaticRegistry is enabled as fontd is not available.
** ARCHIVE FAILED **
Exit status: 65
To debug I ejected to the bare flow and manually added the entry in podfile and I get the same error when building locally via:
expo run:ios
I tried placing the entry at various spots in the Podfile and no luck. I should also mention I'm installing react-native-firebase as a static framework via these pod file entries which are working fine:
$RNFirebaseAsStaticFramework = true
pod 'Firebase', :modular_headers => true
pod 'FirebaseCore', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true
Any idea how I can disable IDFA? I don't need it on my app. I'm just using rn-firebase-analytics for simple event tracking..
I got the same error
@newme616 let me know if u are able to figure out a solution plz
@newme616 let me know if u are able to figure out a solution plz
I downgraded to v14, unfortunately I couldn't find a fast solution yet.
@newme616 let me know if u are able to figure out a solution plz
I downgraded to v14, unfortunately I couldn't find a fast solution yet.
adding this to podfile worked for me:
installer.pods_project.targets.each do |target|
if target.name == "FirebaseAnalytics"
target.remove_from_project
end
end
I put it in this section:
post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
installer.pods_project.targets.each do |target|
if target.name == "FirebaseAnalytics"
target.remove_from_project
end
end
end
But I'm not a native dev so not sure if this will have any unintended side effects. It's based on some stack overflow answers where people were suggesting the same..
So I think the problem is, if you use Expo-related analytics and firebase things, and you mix them here, you'll get duplicate symbols.
Don't do that, basically. That may sound harsh but the reality is each set of things (Expo-related analytics / firebase stuff and react-native-firebase-related stuff) will pull in dependencies.
But ours are really up to date, and Expos are outdated, so you get different copies and different symbols and they clash.
That's my hypothesis based on https://github.com/react-native-device-info/react-native-device-info/issues/1452
@mikehardy I wasn't using expo analytics, only react native Firebase analytics, react native Firebase crashlytics and react native Firebase performance.
I'm satisfied with the workaround I posted earlier, it's working. Just thought I'd mention in case you're looking to make m a proper fix..
Edit: also not using react native device info fwiw
Very strange. Anyway, you removed most of our issue template which would have had package.json dependencies and I could have seen what other packages might have done this -- less information provided, less useful help provided (https://stackoverflow.com/help/how-to-ask)
That said, the workaround you've posted seems to rely on avoiding the use of use_frameworks! (otherwise you wouldn't need any modular headers stuff? That's not a supported configuration, the Podfile must have use_frameworks! in it (ideally, use_frameworks! :linkage => :static so that hermes will work) as that is a strict requirement of the underlying firebase-ios-sdk from the upstream google firebase repo
If there was some series of commands to reproduce (https://stackoverflow.com/help/mcve) I could look at this, but it would have to result in a repro with use_frameworks! set in the Podfile or it's not worth it, since we can't support non-frameworks configs going forward
Here's what worked for me... wanted analytics without ad ID support:
top level of my Podfile:
$RNFirebaseAnalyticsWithoutAdIdSupport = true
then...
target 'MyAppName' do
# use_modular_headers!
# ^^^ I did not need this
rn_maps_path = '../node_modules/react-native-maps'
# beginning of added lines:
pod 'Firebase/AnalyticsWithoutAdIdSupport', modular_headers: true
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec', :modular_headers => false
pod 'Firebase', :modular_headers => true
pod 'FirebaseCore', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true
package.json:
"@react-native-firebase/analytics": "^17.3.0",
"@react-native-firebase/app": "^17.3.0",
pod 'Firebase/AnalyticsWithoutAdIdSupport', modular_headers: true
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec', :modular_headers => false
pod 'Firebase', :modular_headers => true
pod 'FirebaseCore', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true
This is an unsupported workaround and no one should use it.
use_frameworks! :linkage => :static is a strict requirement of firebase-ios-sdk in combination with react-native and anyone attempting to use modular_headers will be unable to receive support here.
It should not be recommended.
Understood... was able to eventually get this working by disabling Flipper (wasn't using it anyway) and re-enabling use_frameworks! :linkage => :static, ran into some Google Maps issues that had some suggested work around on Stack Overflow
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'
$RNFirebaseAnalyticsWithoutAdIdSupport = true
pod 'GoogleMaps'
pod 'Google-Maps-iOS-Utils'
target 'MyAppName' do
config = use_native_modules!
$static_framework = []
use_frameworks! :linkage => :static
rn_maps_path = '../node_modules/react-native-maps'
pod 'react-native-google-maps', :path => rn_maps_path
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text', :modular_headers => true
pod 'react-native-version-info', :path => '../node_modules/react-native-version-info'
pod 'RollbarReactNative', path: '../node_modules/rollbar-react-native'
pod 'Firebase/AnalyticsWithoutAdIdSupport'
pod 'Firebase'
pod 'FirebaseCore'
pod 'GoogleUtilities'
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => false
)
target 'MyAppNameTests' do
inherit! :complete
# Pods for testing
end
$static_framework += [
'react-native-maps',
'react-native-google-maps',
'Google-Maps-iOS-Utils',
'GoogleMaps',
'RNFirebaseAsStaticFramework',
'RNGoogleMobileAdsAsStaticFramework',
'RNAdMobAsStaticFramework'
]
# fixes https://stackoverflow.com/questions/63261101/rctconvertairmap-h-file-not-found-error-on-react-native-on-ios/67945288#67945288
# ****** THIS IS THE MAGIC ******
pre_install do |installer|
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
installer.pod_targets.each do |pod|
if $static_framework.include?(pod.name)
def pod.build_type;
Pod::BuildType.static_library # >= 1.9
end
end
end
end
# ****** THIS IS THE MAGIC ENDED ******
post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end
end
target 'MyAppName-tvOS' do
# Pods for MyAppName-tvOS
target 'MyAppName-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
target 'OneSignalNotificationServiceExtension' do
use_frameworks! :linkage => :static
pod 'OneSignalXCFramework', '>= 3.0', '< 4.0'
end
Hi everyone,
Is there any example expo plugin that sets the "$RNFirebaseAnalyticsWithoutAdIdSupport=true" in Podfile? I would like to add it to my project to avoid problems in app review, but I'm not sure if there is anything specific that should be included in the plugin apart from adding one line at the start of the file?
EDIT: If anyone is looking for the same plugin, here is something that seems to work for me: https://gist.github.com/giautm/402e1732c89548281d6605ef77289476