we are using Flutter as a Module embedded in our project, and we have some problems.
When upgraded to xcode 13.3 , we run into an issue :
Running pod install in the iOS project removes the path to the flutter module like this:
When discarding these lines the project runs and all good, but when including those changes i get a crash:
dyld: Library not loaded: #rpath/App.framework/App
Referenced from: /private/var/containers/Bundle/Application/SomeRandomGeneratedNumber/MyApp.app/MyApp
Reason: image not found
The question is :
Was there a change for the flutter module configuration so the pod install removes the path to the flutter module? how is it connected to xcode13.3 and is there a solution?
Found a workaround :
Install Cocoapods using HomeBrew and not Gem.
See continuation here :
Install Cocoapods : Brew vs Regular installation
Related
Background :
We have an app that embeds Flutter as module in our iOS project. When i install cocoapods using the original option from cocoa like this :
$ sudo gem install cocoapods
and then run pod install in my iOS project, i get the Flutter module thrown out of project file, like mentioned in this issue :
XCode 13.3 Pod Install Removes Path To Flutter Module
Although, i found a workaround : i installed cocoapods using Homebrew and it works perfectly.
My question here is: What is the key difference, or what are the differences between the original website installation of cocoapods and the homebrew one?
NOTE: The same behavior is noticed for apple silicon and intel chips.
My Flutter app was integrated with Firebase and the app was building successfully with Firebase core and auth. However when I added the cloud_firestore: ^2.2.0 dependency, the build fails on iOS (still works on Android) with the following error message:
In file included from /Users/charismak/AndroidStudioProjects/foodstack/ios/Pods/gRPC-Core/src/core/ext/filters/client_channel/xds/xds_channel_secure.cc:34:
In file included from /Users/charismak/AndroidStudioProjects/foodstack/ios/Pods/gRPC-Core/src/core/lib/security/credentials/credentials.h:35:
In file included from /Users/charismak/AndroidStudioProjects/foodstack/ios/Pods/gRPC-Core/src/core/lib/security/security_connector/security_connector.h:33:
/Users/charismak/AndroidStudioProjects/foodstack/ios/Pods/gRPC-Core/src/core/tsi/ssl_transport_security.h:28:10: fatal error: 'openssl/x509.h' file not found
#include <openssl/x509.h>
^~~~~~~~~~~~~~~~
1 error generated.
When I remove the dependency, it builds successfully.
I have tried running pod install, flutter clean, changing the deployment target on Xcode and podfile, and installing/upgrading openssl.
It is the same issue as this: Not found 'openssl/x509.h' when install cloud_firesore flutter?
I solved it by running the following commands in terminal inside <your_project_path>/ios:
rm -rf Pods Podfile.lock
pod cache clean --all
pod install
(Installation may take some time to complete)
Source: https://github.com/FirebaseExtended/flutterfire/issues/3203#issuecomment-743789416
Here's Flutter and Xcode versions:
Flutter 1.22.5 • channel stable
Version 12.3 (12C33)
I have a Flutter application and I get the following error when trying to install the pods:
The error message was about AgoraRtcEngine, previously I was using agora 3.2.1 and the error message complained that I need 3.3.1 and then I upgraded it.
Then I try to install all the dependencies, unfortunately, I got the The 'Pods-Runner' target has transitive dependencies that include statically linked binaries error.
I tried below commands but failed with the attached error:
flutter clean
remove ios/Flutter/Flutter.framework
remove PodFile and PodFile.lock
flutter build ios
Does anyone know what is the cause and how to solve it? Thanks.
You might want to update CocoaPods, what version are you currently using
https://github.com/CocoaPods/CocoaPods/issues/7234#issuecomment-346119807
follow the instructions that are given in terminal output:
sudo gem install cocoapods
you might wanna upgrade your CocoaPods and also your flutter version
upgrading your installing CocoaPods -> "sudo gem install cocoapods"
this will take a while or throw error, incase of error try manually downloading cocoapods from web " https://cocoapods.org/app " this will download a dmg application file.
and for flutter
try "flutter upgrade"
I upgraded my Xcode to 12. Everything was working perfectly and all of a sudden I kept getting bellow error message (Image below)
SO link have tried using to solve this issue
SO Link
What I've done so far
Cleaned Build Folder
Restarted Xcode
Updated Cocoapods
Deleted DerivedData
Cleared pod cache
Deleted pods directory and file and reinstall
None of them worked and its getting frustrating.
Pod file
All I did was to follow the instruction(see image below) and it got fixed.
Source here
I had the same problem with a project still targeting iOS 8 as the minimum iOS version. This steps solved my problem:
Update minimum target iOS version to iOS 9 on Podfile file;
Open terminal on project folder, remove all pod file dependencies and update them by running:
rm -rf /Pods
pod repo update
pod install
Update minimum project target iOS version to iOS 9;
Remove DerivedData;
Clean project;
Compile/run project again.
A simpler solution is to update cocoapods to the 1.10 version
First, update the CocoaPods installation :
[sudo] gem install cocoapods
Then, update your project : bundle update cocoapods
Finally, run pod install and everything should be OK :)
If the previous solutions did not help someone, then try changing it this way:
#include <nanopb/pb.h>
->
#include "nanopb/pb.h"
This issue CAN be the result of developing iOS on an M1 (Apple Silicon) machine. In this case, the only way to fix the problem is to download a Ruby extension called "ffi" which you can read about here (for extra information): https://rubygems.org/gems/ffi/versions/1.0.9
To do this:
In Terminal, install ffi onto your machine using this command:
sudo arch -x86_64 gem install ffi
Then in your project file, install your podfile with this command:
arch -x86_64 pod install
This should allow you to install your pods (especially if you were getting a "zsh: abort pod install" problem. Notice Terminal will warn you "a bug in the Ruby interpreter or extension libraries".
After this, if your pod was FireStore/FireBase you may have to get another GoogleService-Info.plist file in your project.
I have flutter module added to the existing iOS app. Not all but few of the packages installed (via pubspec.yaml file) could not be found by the iOS app when compiled, and I'm getting 'Module not found' error in XCode. Those problematic packages are: razorpay_flutter, google_maps_flutter, webview_flutter, and url_launcher until now. Please have a look at screenshot below:
Same is the case with other 3 packages.
Steps to reproduce issue:
Add razorpay_flutter: ^1.1.3 in the pubspec.yaml file of the
flutter module
Run flutter pub get. The package will install
Run Xcode project to which flutter module is added. Got error!
One more thing I observed after step 2, that there is some warning regarding issue for add to existing app:
Running "flutter pub get" in lib_smazing...
The plugin `razorpay_flutter` is built using an older version of the Android plugin API which assumes that it's running in a full-Flutter environment.
It may have undefined behaviors when Flutter is integrated into an existing app as a module.
The plugin can be updated to the v2 Android Plugin APIs by following https://flutter.dev/go/android-plugin-migration.
I guess there is issue with the packages using platform channel/code when added to an existing app, but not sure whether its package-specific issue or a flutter issue with add-to-app.
After few trials and error I found simply running pod install on iOS project directory fixed the issue.
Rather trivial but realized my packages were not found because I opened and executed the wrong file in XCode - so open Runner.xcworkspace and not Runner.xccodeproj
There are multiple solutions available for any kind of library/module not found.
Solution # 1
flutter clean
flutter run again
rebuild it from ios or vscode tool again.
if still problem
pod update
pod repo update
pod install
Solution# 2
delete build folder
delete pod.lock file
delete .syslinks folder
delete pods folder
change your directory in your terminal by
cd ios
pod install --repo-update OR pod repo update
pod install
flutter clean
flutter pub get
Solution# 3
please open Runner.xcworkspac with xcode because app will get local
lib from pod install lib that installed. , but don't Runner.xcodeproj