Google Firebase build error for iOS from Unity - ios

I recently tried to setup Google Firebase Analytics for my Unity game. I am building it for iOS exclusively. I have not been able to get Firebase working unfortunately.
I am using Xcode 8.1, OSX 10.12.1, and Unity 5.5.0f3
Whenever I try to build to iOS from Unity, I get this error in console:
Error running cocoapods. Please ensure you have at least version 1.0.0. You can install cocoapods with the Ruby gem package manager:
sudo gem install -n /usr/local/bin cocoapods
pod setup
'pod --version' returned status: 127
output:
UnityEngine.Debug:LogError(Object)
Google.IOSResolver:Log(String, Boolean, LogLevel)
Google.IOSResolver:OnPostProcessInstallPods(BuildTarget, String)
UnityEditor.HostView:OnGUI()
I have tried just about every suggestion I could find online. I have installed Cocoapods version 1.1.1, and later I tried the beta version 1.2.0.beta.1, nothing has worked.
Typing "which pod" in my terminal yields: /usr/local/bin/pod
Typing "pod --version" in my terminal yields the correct version number (i.e.: 1.2.0.beta.1)
I cannot get this build to work in my game's project, or a completely empty project to which I just imported firebase and tried to build.
I also tried to get this working with the sample project at the following link with no success: https://github.com/firebase/quickstart-unity
I am out of ideas here... can anyone help?
Much appreciated!

Firebase engineer here.
The code reporting the error is here:
https://github.com/googlesamples/unity-jar-resolver/blob/b7a90e43d6c893622102ca53681f53a58dab1a24/source/IOSResolver/src/IOSResolver.cs#L760
unfortunately, it looks like we're not logging the stderr stream so it's tricky to see how this is failing.
It sounds like your pod tool is returning a non-zero error code, not sure why. For example, on my machine I see the following:
$ which pod
/usr/local/bin/pod
$ pod --version ; echo $?
1.1.1
0
As you can see "pod --version" is returning "0" (success).
Similarly, pulling the latest Cocoapods tool from github https://github.com/CocoaPods/CocoaPods yields:
cd CocoaPods
export RUBYLIB=$(cd lib ; pwd)
export COCOAPODS_NO_BUNDLER=1
$ ./bin/pod --version ; echo $?
1.2.0.beta.1
0
Where the same thing is happening, the pod tool is returning a success exit code.
Things to try:
Contact support#firebase.google.com - we'll be able to work directly with you to diagnose and resolve this issue.
Try changing your LANG variable, we've been tripped up by this code https://github.com/CocoaPods/CocoaPods/blob/8db5956/bin/pod#L3 in the past. It's supposed to be handled by https://github.com/googlesamples/unity-jar-resolver/blob/b7a90e4/source/IOSResolver/src/IOSResolver.cs#L743 but you never know.
If you feel brave, build https://github.com/googlesamples/unity-jar-resolver/ yourself (you should be able to run ./gradlew in the root directory to build the DLLs) then you can add the stderr reporting, post / diagnose the error you're running into.
Cheers,
Stewart

If you have this error in your output:
Failed to extract git version from `git --version` ("xcrun: error: active developer path (\"/Applications/Xcode.app/Contents/Developer\") does not exist\nUse `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --install` to install the standalone command line developer tools.\nSee `man xcode-select` for more details.\n") (RuntimeError),
...and IF you have a different path to XCode (like in my case, I had Xcode beta), then you should run the command:
sudo xcode-select --switch /Applications/Xcode-beta.app/

Related

xcodebuild error: "requested but didn't find extension point with identifier ..."

I'm using Xcode 13.3.1.
I'm trying to build a flutter application in Android Studio. It failed with the following error. To make it dead simple I tried just running xcodebuild which produced the same error as in Android Studio:
.oh-my-zsh git:(master) xcodebuild
2022-04-21 19:45:25.858 xcodebuild[32450:312401] 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-04-21 19:45:25.859 xcodebuild[32450:312401] 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
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild
User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YES
xcodebuild: error: The directory /Users/salahuddin/.oh-my-zsh does not contain an Xcode project.
Any idea what causes this error and how to fix it?
Please refer to the message, you can find out solution.
https://developer.apple.com/forums/thread/703233
SOLUTION (for me):
I had to first find the software update manually:
softwareupdate --list
This provided me with the following output:
Finding available software
Software Update found the following new or updated software:
Label: Command Line Tools for Xcode-13.3
Title: Command Line Tools for Xcode, Version: 13.3, Size: 718145KiB, Recommended: YES,
I then ran:
softwareupdate -i "Command Line Tools for Xcode-13.3"
(NOTE: You pass the "Label:" output as the string as yours could be different.
This command worked out for me: softwareupdate -d -a.
Reference: https://huckfinnsmoneytree.com/how-to-download-macos-updates-using-the-terminal/
I faced the same problem when updating the project with Flutter 3. After several attempts, the below solution worked for me.
I have deleted the podfile.lock file inside the ios folder and then run the below commands.
flutter pub upgrade
flutter pub get
cd ios
pod repo update > Actually, this was an error for me but ignored it
pod install
Also please make sure you are using the latest MacOS and Xcode.
I hope this will help someone else.
Looks like you need to install the Xcode command line tools, which you can do by executing the following command in Terminal:
xcode-select --install
This worked for me:
Completely turn off Bluetooth.
in ios/ folder of your project, change Podfile to
platform :ios, '12.0'
Run pod deintegrate in Terminal inside the ios/ folder of your project.
Run pod install --repo-update in your ios/ folder
https://solveforums.msomimaktaba.com/threads/solved-flutter-for-ios-run-build-but-not-archive.699314/
The error mentions that there's no iOS project to be found on the directory.
xcodebuild: error: The directory /Users/salahuddin/.oh-my-zsh does not contain an Xcode project.
You'd need to navigate to the iOS build of your Flutter project on your terminal with cd ios and run xcodebuild there.
multiple xcode.app you need to remove.(Download folder)
XCode-> Preferences-> Locations -> Command Line Tools
Check it shows multiple entries for same xcode version.
Delete xCode.app other than Application folder.
quit and restart xcode and terminal.
My issue was that I was using Xcode 13.4. I downloaded Xcode 13.3 from here and everything started working again.
I was encountering this issue on a self-hosted GitHub runner so in order for the fix above to work, I needed to:
Uninstall the Xcode 13.4
Remove the GitHub runner
Install Xcode 13.3
Re-add the GitHub runner
Try This.
Remove any command line tools:
sudo rm -rf /Library/Developer/CommandLineTools
Reinstall them:
xcode-select --install
Tell the system to use them:
sudo xcode-select -s /Library/Developer/CommandLineTools
If still not working, try that:
In Xcode > Preferences > Locations tab
Simply select the right toolset.

React Native - FBReactNativeSpec Command PhaseScriptExecution failed with a nonzero exit code

I am using a MacBook Pro with
M1 chip
MacOS Big Sur
Xcode Version 13.2.1
node v14.17.5
I wanted to follow this tutorial to set up a new React Native project called AwesomeProject https://reactnative.dev/docs/environment-setup the section with React Native CLI Quickstart.
When I try to run the app in terminal by typing: npx react-native run-ios
my build fails with the following error:
PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/thomashuber/Library/Developer/Xcode/DerivedData/AwesomeProject-aprperxvqrezbfeyvousbagyesvr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBReactNativeSpec.build/Script-5F4C70EF7D90A5A5BDAEB404279F232A.sh (in target 'FBReactNativeSpec' from project 'Pods')
(1 failure)
When I try to run it in Xcode either on a simulator or on an iPhone device I get the following error in FBReactNativeSpec:
/bin/sh -c /Users/thomashuber/Library/Developer/Xcode/DerivedData/AwesomeProject-aprperxvqrezbfeyvousbagyesvr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBReactNativeSpec.build/Script-5F4C70EF7D90A5A5BDAEB404279F232A.sh
Command PhaseScriptExecution failed with a nonzero exit code
I restarted my MacBook, I deleted the project and tried it again. I cleaned the project in Xcode but none of it helps. I suspect that it is due the M1 chip of my MacBook.
For me anyone of this solutions work because, with Xcode 14.2 and RN0.70.5, there is the following 2 files in ios folder which fixe node version with the path (I don't know since which version and which one adds this files) :
.xcode.env
.xcode.env.local
If you are this files inside ios folder just do this (with or without nvm) :
which node
And put the patch inside the .xcode.env.local like this :
export NODE_BINARY="/Users/Blabla/.nvm/versions/node/v16.14.0/bin/node"
If this files doesn't exist, try to add it and maybe Xcode will take it into account :
Inside ios/.xcode.env
# This `.xcode.env` file is versioned and is used to source the environment
# used when running script phases inside Xcode.
# To customize your local environment, you can create an `.xcode.env.local`
# file that is not versioned.
# NODE_BINARY variable contains the PATH to the node executable.
#
# Customize the NODE_BINARY variable here.
# For example, to use nvm with brew, add the following line
# . "$(brew --prefix nvm)/nvm.sh" --no-use
export NODE_BINARY=$(command -v node)
Inside ios/.xcode.env.local
export NODE_BINARY="/Users/Blabla/.nvm/versions/node/v16.14.0/bin/node"
If you shut down your computer or did a recent upgrade to node or nvm something in the cache folder gets reset and the build fails. The code in the react native node_modules/react-native/scripts/find-node.sh script related to nvm. Following this advice: https://stackoverflow.com/a/70104375/5927929 worked for me with a small change.
My specs:
Mac intel chip
RN 0.68.2
nvm (0.33.11) && node (v18.3.0) install
Steps:
nvm unalias default
nvm alias default node
Build in xcode...done
I managed to get rid of the FBReactNativeSpec error by editing the Project settings.
Try the following:
In Xcode select your app's project and then select the target.
In Terminal enter the following command to find out the path of your node installation:
which node
This should give you a path. Something like:
/Users/thomashuber/.nvm/versions/node/v16.14.0/bin/node
Copy this path.
In Xcode with the target selected click on Build Phases and open Bundle React Native code and images
Replace NODE_BINARY=node. Instead of node enter the path that you have copied so that it is something like this NODE_BINARY=/Users/thomashuber/.nvm/versions/node/v16.14.0/bin/node
Simply delete the FBReactNativeSpec file from the Pods as shown in the image below.enter image description here
In my case this error raising due to node path is not set in PATH Variables.
Try to run below command it will set missing node path in PATH variable and it resolve the error.
sudo ln -s $(which node) /usr/local/bin/node
https://reactnative.dev/docs/new-architecture-troubleshooting#:~:text=Command%20PhaseScriptExecution%20failed%20with%20a,libraries%20(FBReactNativeSpec%2C%20rncore).
Ok, worth trying this.
2 different solutions :
1: As soon as we get this error message:
Always scroll up & read the issue if written in that log file. Any issues like syntax error or issue related to your js code (like multiple imports in your js files or if you had forgot to import something).
If yes, you can fix that first & re build it.
In my case I had multiple imports of one of the RN components.
if not
2: got to 'Keychain access' in your mac, lock & unlock login and re build it, this may help you.
And make sure to
'cd ios' && 'pod install'
if you have forgot to do it after installing any of the npm package.
In case someone else tried everything mentioned here and in other threads, and it didn't work, here is what worked for me!
I uninstalled my nvm install
installed node globally (https://nodejs.org/en/download/)
ran pod install and got this error message:
[!] CocoaPods could not find compatible versions for pod "hermes-engine":
In snapshot (Podfile.lock):
hermes-engine (from ../node_modules/react-native/sdks/hermes/hermes-engine.podspec)
In Podfile:
hermes-engine (from ../node_modules/react-native/sdks/hermes/hermes-engine.podspec)
It seems like you've changed the version of the dependency hermes-engine and it differs from the version stored in Pods/Local Podspecs.
You should run pod update hermes-engine --no-repo-update to apply changes made locally.
But instead of running the command they gave me, I deleted Podfile.lock and the Pods directory, then reran pod install, and the build finally worked!
Determine what your node binary is:
$ which node
/opt/homebrew/bin/node
Add a fixer function in your Podfile:
def fix_fb_react_native_spec(installer)
installer.pods_project.targets.each do |target|
if target.name == 'FBReactNativeSpec'
target.build_configurations.each do |config|
if config.name == 'Debug' or config.name == 'Release'
config.build_settings['NODE_BINARY'] = '/opt/homebrew/bin/node'
end
end
end
end
end
In your postinstall, add fix_fb_react_native_spec(installer) like so:
post_install do |installer|
react_native_post_install(installer)
fix_fb_react_native_spec(installer)
end
Pod install
Rebuild (ideally with a clean build)
In my case:
M1 chip
MacOS Monterey
Xcode Version 13.2.1
node v16.6.0
react-native 0.69
I was trying to build the iOS app via terminal under Rossetta. Once I tried to use native M1 terminal - it worked well.
Go to your applications, right click on the app, get info, check OFF Open using Rossetta

React Native Invalid Podfile file: [!] Unable to locate the executable node

I'm using Macbook pro-2020 apple M1 Chip, I have created a new ReactNative project and it runs fine on the simulator but if i have to install any other plugins, and have to install pods. it gives me errors like this.
i have installed all the requirements app running fine but once it comes pod installs it fails each and every time. any help would be much appericiated.
I believe this has been answered in how-to-running-cocoapods-on-apple-silicon-m1
I recommend following the updated answer for 2022. If you haven't already, use Homebrew, even tho it's not recommended by the maintainers. M1 with ARM architecture is amazing but many libraries are still not compatible and need to be run in x86 mode.
I would uninstall everything, including and gems you used originally, and run the following Homebrew commands and link them all....
brew install node
brew install yarn
brew install cocoapods
Reinstalling those should now work when you run pod install inside your ios file. This is what worked for me. Hope this helps.
I was facing the same error, this is what worked for me:
I first reinstalled the node, yarn, CocoaPods, after that I run the following commands:
brew link cocoapods
If still gives you error, remove old linked pod using following command:
rm '/opt/homebrew/bin/pod'
Now run this command again:
brew link cocoapods
Once the above command works successfully, then move to your project's iOS folder and run the following command:
pod install

Command PhaseScriptExecution failed with a nonzero exit code - using CocoaPods

I'm getting the following error when building my project: Command PhaseScriptExecution failed with a nonzero exit code.
This is what I have in my [CP] Embed Pods Frameworks:
I've also done a pod deintegrate and pod install but these frameworks continue to show in red:
I'm on Xcode Version 12.4 and my mac has an Apple M1 chip. Any thoughts as to what I could do to resolve this error?
Clearing the Excluded Architectures solved the issue. I originally had arm64 and x86_64 excluded.
Did you solve your issue?
I got the one of solutions.
First of all, you have to delete the files which are red of iOS, Frameworks . They don't exist anymore, so you shouldn't include them to archive.
then clean up your builds.
(click Xcode -> product -> clean build folder)
go to archive.
(click Xcode -> product -> archive)
If you don't use M1, then you have to exclude architectures "arm64".
That's it.
Hope it works.
clear all files inside Library/Developer/Xcode/DerivedData/
List item clean & build again from xcode
if you're using nvm make sure you don't have another globally installed version of Node/npm.
If you aren't sure whether or not you have a global version, go to your bash_profile/zshrc and comment the three nvm initialization lines (export NVM_DIR="$HOME/.nvm" [...]), then open a new terminal and do node --version, if it still finds something it means that you have a global version somewhere, and you can find its path with which node.
In my case I'm using Homebrew, and I had a global version of Node that I wasn't even aware coming from the yarn formula, I discovered it after running brew uses --installed node. I went ahead and uninstalled yarn using brew uninstall --force yarn, which automatically uninstalled its node/npm dependency, then uncommented the nvm initialization lines, and then I reinstalled yarn using nvm's npm with npm i -g yarn, and now everything works.
Another way, after installing node via brew install node RUN sudo ln -s /opt/homebrew/bin/node /usr/local/bin/node
restart xcode and try to build again.

React Native ios build failed on react-native run-ios

getting this error
** BUILD FAILED **
The following build commands failed:
CompileC /Users/karthikn/AwesomeProject/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/React.build/Objects-normal/x86_64/RCTTabBarItem.o Views/RCTTabBarItem.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/AwesomeProject.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/AwesomeProject.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Xcode 8.2 still occur same error. Three lines bellow fixed it for me :)
Downgrade react(16.0.0-alpha.12 -> 16.0.0-alpha.6) & react-native(0.45.0 -> 0.44.0)
rm -rf node_modules/react
npm i react#16.0.0-alpha.6 -S
npm i react-native#0.44.0 -S
Then run react-native run-ios
Your build could be failing because of the current node js version installed, or due to your pod files or a number of other reasons.
This error may also be when cloning a react native repository from github.
This solution may work as I was able to recreate this issue(refer to the screen shots):
Solution one:
firstly:
If you have the latest version of node js installed you may have some compatibility issues with some of the dependencies, install the recommended version of Nodejs instead.
after installation, reinstall your dependencies and update your pod files:
npm install
cd ios
pod install
or
pod update
solution two:
this can happen if you haven't installed react native previously on your system and are trying to run a clone react native repository from github.
brew install watchman
sudo gem install cocoapods
then in the rn project clone
cd ios
pod install
Problem:
This is what the error message looks like:
legacy compatibility issues:
Build failed
Solution:
After following the above steps this issue was resolved instantly:
If it's your first project, you may have the same problem than me:
do NOT use space in your project path! 🎉 😄
If your xcode is open, close it
Remove DrivedData
Update your pod files using pod update command
Run npx react-native ios command
its worked for me i hope work for you too
There's a good chance you're running an outdated version of React-Native and your template is no longer compatible.
There are instructions provided on ways to upgrade.
The simplest would be to run react-native upgrade and you'll be prompted with files react-native wants to overwrite. Clicking yes through all the prompts solved this issue for me but if you're concerned about losing any changes, it's recommended to install npm install -g react-native-git-upgrade and merge any conflicts after running react-native-git-upgrade
Try sudo react-native run-ios
This helped me
Check this In Your info.plist Bundle identifier
Or Add this Bundle identifier name as --> com.cmpname.yourapp // change name according
DO NOT use space in project path. It had solved my problem.
Replace Boost C++ Libraries with this one Download Link
/node_modules/react-native/third-party/boost_1_63_0
seems like there is an issue with the react-native version, downgrading the version will resolve the issue. Use the following commands:
rm -rf node_modules/react
npm i react#16.0.0-alpha.6 -S
npm i react-native#0.44.0-alpha.6 -S
react-native run-ios
There are different problems that cause this issue. I'll post here what I did to resolve in my case.
1 - Delete the folder node_modules and the folders of android and ios from project root:
rm -rf node_modules/ ios/ android/
2 - Rebuild the folders:
npm install && react-native upgrade
or (If you have used yarn in the project)
yarn install && react-native upgrade
3 - After that, just run the command again:
react-native run-ios
or
react-native run-android.
I hope it helped =)

Resources