Xcode -FirebaseCore Lexical or preprocessor issue 'GoogleUtilities/GULAppEnvironmentUtil.h' file not found
I ran $ sudo gem which cocoapods
and it said the version I was using was cocoapods-1.7.3
. Luckily my old computer still had the old version of cocoapods that was working fine which was cocoapods-1.5.3
.
I did 5 things
1- I uninstalled the current version of cocoapods and installed the previous version:
$ sudo gem uninstall cocoapod // uninstall current version
$ sudo gem install cocoapods -v 0.25.0 // install the older version that was working
$ sudo gem which cocoapods // check the updated version
2- I ran the following commends to clean everything out although cleaning out the derived data was probably the only one I needed
$ rm -rf ~/Library/Caches/CocoaPods
$ rm -rf Pods
$ rm -rf ~/Library/Developer/Xcode/DerivedData
$ pod deintegrate
$ pod clean
$ rm Podfile
$ pod cache clean --all
3- After I ran $ pod init
to create the podfile, I opened it and made sure the minimum version I'm using in my Xcode project matches what's in the podfile and I also added install! 'cocoapods', :deterministic_uuids => false
to the root of the pod file
# Uncomment the next line to define a global platform for your project
platform :ios, '12.0' // my Xcode project has a minimum target of iOS 12
install! 'cocoapods', :deterministic_uuids => false // this line should be written before the target line with the project name below
target 'MyProjectName' do
...
- After I did the above and I ran
pod install
I kept getting an error that said:
[!] CocoaPods could not find compatible versions for pod
"Firebase/Crash": In Podfile:
Firebase/Crash Specs satisfying theFirebase/Crash
dependency were found, but they required a higher minimum deployment target.
Inside my pod file I commented out Firebase/Crash
$ #Firebase/Crash
5- Afterwards I ran pod install
I also ran pod update
and the error from my question went away:
$ pod install
$ pod update
The FirebaseCore Lexical or preprocessor 'GoogleUtilities/GULAppEnvironmentUtil.h' file not found
was finally resolved although I some other errors like 'NBPhoneNumberDesc.h' file not found
that was already there but these are the steps I used to get rid of this GoogleUtilities one.
Xcode 12 using Firebase pods. Lexical or Preprocessor issue. pb.h' file not found with angled include; use quotes instead?
Update to CocoaPods 1.10, run pod deintegrate
and pod install
.
To work around in earlier CocoaPods versions, disable the CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER
option in the generate Pods project Build Settings:
More details in https://github.com/firebase/firebase-ios-sdk/issues/5987 and https://github.com/CocoaPods/CocoaPods/issues/9902.
Lexical or preprocessor issue in Xcode 8.0
For those who facing this issue, it is due to header import issues with react native 0.41.2 along with cocoapods
To resolve these errors follow these steps
1npm install -g react-native-git-upgrade
2 go to your project root folder and do
react-native-git-upgrade
3 Solve conflicts if any occur while upgrading RN
4 Now remove React dependencies from pod file else you will have two React in schemes(One RN and One Pod) and it will cause no input error
while building. Your pod file should look like this
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git'
target 'Inspector' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for Inspector // Pods for your app, in this case firebase is used
pod 'Firebase/Core'
pod 'Firebase/Messaging'
target 'Inspector-tvOSTests' do
inherit! :search_paths
pod 'Firebase/Messaging'
# Pods for testing
end
target 'InspectorTests' do
inherit! :search_paths
pod 'Firebase/Messaging'
# Pods for testing
end
end
5 cd ios && pod install
6 Close Xcode and open .xcworkspace file
Xcode: lexical or preprocessor issue - redefinition of module
I commented flipper_post_install(installer)
in Podfile
.
Afterwards, it gives another interpolate is not a function
error but anyway it cleared the lexical or preprocessor issue
error away.
lexical or Preprocessor issue GAITrackedViewController.h not found when running unit tests
I solved the problem and decided to post the answer incase someone runs into this problem one day.
The problem is caused by cocoapods headers not linking to test targets thus to fix the issue I had to add a separate target definition in my podfile.
I added the targets as follows:
target ‘Project NameTests' do
inherit! :search_paths
project 'Project Name.xcodeproj'
end
target 'Project NameUITests' do
inherit! :search_paths
project 'Project Name.xcodeproj'
end
Why am I getting the error ''FirebaseCore/FirebaseCore.h' file not found' when trying to run my iOS app
If someone is still facing the problem,
If you already cleaned the build folder, remove derived data, remove pod.lock and the pods folder what I suggest is to open the terminal and
insert :
pod deintegrate && pod install
The difference is caused by the deintegrate call which will remove build phases as well as the framework folder.
To consider also :
Using a M1 chip MacBook, what happened to me as well was getting the said error when building the project for a simulator and not a real device / macbook.
UPDATE:
All the firebase dependencies are supposed to run on M1 simulators.
For general knowledge though:
If some dependency is failing you on a M1 Macbook, arm64 simulator, find the 'libName'.xcframework of the wanted dependency, and make sure it contains a 'ios-arm64_x86_64-simulator' folder, then drag and drop it at the your project root (copy or reference as you prefer).
If the dependency fails to be found whilst building:
open you Project in the project navigator => Find your Target in the Targets column => General dongle => scroll to Framework, Libraries and Embbeded Content and embed your libary which was in a "Do not Embed" status.
The best way to do so is through Carthage.
Nice to know : If the wanted dependency doesn't contain the required folder, it's still possible to ask the devs directly on Github.
Related Topics
Xcframework Issue, a Library with the Identifier "Ios-Armv7_Arm64" Already Exists
How Would I Create a Constant That Could Be One of Several Strings Depending on Conditions
Getting Data Out of Nsdata with Swift
Overriding Generic Function Error in Swift
How to Use Case Enum Comparison as a Boolean Expression
Implemented Helper App But Does Not Launch on Login
Swiftui Overlay Blocking List Scroll Events
Drag and Drop Image from Uicollectionview to Uiview
In Swift, Why Can't I Instantiate a Protocol When It Has an Initialiser
Swift Generic Constraints in Init
Ios8 Swift Uisearchcontroller Hides Navigationbar
Uitableviewautomaticdimension Not Working on iOS 8
Pattern Variable Binding Cannot Appear in an Expression