I'm encountering a build error in Xcode when trying to build my iOS app using Expo. The error message is:
error: Build input file cannot be found: '/Users/expo/workingdir/build/.../ios/GoogleService-Info.plist'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it?
I have already added GoogleService-Info.plist
to the root of my project in Xcode. Despite this, the build process seems unable to locate the file. Here are the steps I've taken:
GoogleService-Info.plist
to my project (made sure it's in the root).Is there a specific way I need to declare this file in Xcode to resolve this error, especially considering it's being built with Expo? Any insights or suggestions on how to fix this would be greatly appreciated!
After spending a good amount of time troubleshooting this issue in my Xcode / React Native project, I finally cracked the problem related to GoogleService-Info.plist
not being found in my project.
error: Build input file cannot be found: '/Users/expo/workingdir/build/frontend/mobile/ios/GoogleService-Info.plist'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it?
The error was pretty annoying at first, but after some trial &. error, I managed to find a working solution.
I opened my project in Xcode.
Launch Xcode and open your project. Navigate to Your Target's Build Phases.
Click on the project file (the blue icon) at the top of the Project Navigator. Select your app's target from the list. Add or Edit a Run Script Phase:
Go to the "Build Phases" tab.
If you already have a script phase that should produce GoogleService-Info.plist, click on it to expand and edit the script.
If you don't have a relevant script phase, add one by clicking the '+' button at the top left of the "Build Phases" section, then choose "New Run Script Phase".
Ensure that the script writes the output file to the correct location, typically to $(SRCROOT), $(BUILT_PRODUCTS_DIR), or $(TARGET_BUILD_DIR) depending on your project structure and requirements. Specify Output Files (Optional):
Below the script editor, you may see an area to specify "Output Files" or "Output Files List".
Here, you can add the path where the script will place GoogleService-Info.plist. For example:
Input the expected path of the GoogleService-Info.plist
file, like:
$(SRCROOT)/GoogleService-Info.plist // <-- If project in Root PATH.
or like
$(SRCROOT)/path/to/GoogleService-Info.plist // <-- If project in nested PATH.
This step, while not mandatory, turned out to be quite insightful for incremental builds. It’s a good way to let Xcode know when it needs to re-run the script.
I then ran a new build on my expo project after cleaning my xcode build folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With