Flutter: Cocoapods The 'Pods-Runner' target has transitive dependencies that include static binaries: Flutter.framework - swift

I am getting this error while running pod install
[!] The 'Pods-Runner' target has transitive dependencies that include static binaries: (/Users/me/Documents/flutter/flutter/bin/cache/artifacts/engine/ios/Flutter.framework)
After doing bit of a research it says use frameworks! in my Podfile is causing the issue. If I comment out use frameworks! I get this error. Any idea on what the issue is? I have been stuck here for the past three days.
ld: framework not found Flutter
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Also according to whats written here. Adding the following to Podfile also didn't work for me. This is how my Podfile looks.
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
def parse_KV_file(file,seperator='=')
file_abs_path = File.expand_path(file)
if !File.exists? file_abs_path
return [];
end
pods_ary = []
skip_line_start_symbols = ["#", "/"]
File.foreach(file_abs_path) { |line|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
plugin = line.split(pattern=seperator)
if plugin.length == 2
podname = plugin[0].strip()
path = plugin[1].strip()
podpath = File.expand_path("#{path}", file_abs_path)
pods_ary.push({:name => podname,:path=>podpath});
else
puts "Invalid plugin specification: #{line}"
end
}
return pods_ary
end
target 'Runner' do
# Flutter Pods
#use_frameworks!
pod 'EstimoteSDK'
pod 'SwiftKeychainWrapper'
pod 'Alamofire'
generated_xcode_build_settings = parse_KV_file("./Flutter/Generated.xcconfig")
if generated_xcode_build_settings.empty?
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter build or flutter run is executed once first."
end
generated_xcode_build_settings.map{ |p|
if p[:name]=='FLUTTER_FRAMEWORK_DIR'
pod 'Flutter', :path => p[:path]
end
}
# Plugin Pods
plugin_pods = parse_KV_file("../.flutter-plugins")
plugin_pods.map{ |p|
pod p[:name], :path => File.expand_path("ios",p[:path])
}
end
pre_install do |installer|
# workaround for https://github.com/CocoaPods/CocoaPods/issues/3289
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end

For me, I deleted the ios/Flutter/Flutter.framework folder and install pods pod install again then it worked.

Delete ios/Flutter/Flutter.framework folder.
Install pods again then it worked. It will regenerate the deleted folder
pod install

In my case I don't have Flutter.framework, so the following solution worked for me
Inside the Podfile use_frameworks! :linkage => :static

This process solve it for me :
Delete ios/Flutter/Flutter.framework folder.
Delete ios/PodFile
Delete ios/PodFile.lock
Go to the project root and re-save the file pubspec.yaml (on VSCode, this will automatically runs the following command : flutter get pub)
Run the project again
Let me know if it works for you too

A complete reinstallation of flutter works for me.

Delete ios/Flutter/Flutter.framework folder.
Install pods again then it worked. It will regenerate the deleted folder
pod install

In your podfile where You see
target 'Runner' do
use_frameworks!
comment user_frameworks!
target 'Runner' do
comment below line
use_frameworks!
and go to path /ios of the project
run
pod install

what worked for me is
deleted the ios/Flutter/Flutter.framework folder
ran flutter create -i swift --org com.orgname .
I was able to run the app without pod install (after this procedure)

Please check the ios/project.pbxproj. I was moved project to another folder and I forgot to replace the FLUTTER_TARGET and FLUTTER_APPLICATION_PATH with the newest one in the ios/project.pbxproj.

Commenting out use_frameworks! in the podfile, worked in my case.

Related

xcode: no such module 'Kingfisher'

I want run my app on emulator
But I get this error:
no such module 'Kingfisher'
pod update, pod install, delete DerivedData folder, restart xcode, use xcworkspace, use xcodeproj and ... not solved my problem!
OS: 11.4
xcode: 12.4
My pod:
platform :ios, '11.0'
use_frameworks!
target 'Name' do
pod 'QuickBlox'
pod 'Quickblox-WebRTC'
pod 'Alamofire'
pod 'Kingfisher'
pod 'NVActivityIndicatorView/Extended'
pod 'PulsingHalo'
pod 'ImageScrollView'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
end
please use these commands in order in the project directory
1- pod deintegrate
2- rm podfile.lock
3- pod install
then clean project and build it should work
It happens to me sometimes.
first, clean build and then rebuild the project.
if there is no success try pod install, otherwise restart your device.
In my case Kingfisher worked with iOS and not with macOS. I used Xcodes package installer and not pod install. In order to fix my "no such module 'Kingfisher'" error for macOS:
I had to go to my TARGETS. (on the left side of General/Signing/etc)
Click on your macOS target.
Click "Build Phases" (2nd to last on the top row)
Go down to 'Link Binary with libraries.'
Click the '+' button and add the Kingfisher library.
If you have the error in your iOS version then add the library to that target instead. This won't fix everyone's issue, but no other solution I could find online worked and finally after clicking around I found this library was missing and it fixed my error, so I hope it helps someone.
Adding this to podfile helps me
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end

How to fix cocoapod .modulemap file not found

When I try to build my project, I get a compile time error saying that a "Module map file" for my pod cannot be found and that I am missing a "SwiftShimes" module.
This is weird because all my modulemap files are where they should be when I install my pods.
I am using Xcode 10.2 and Cocoapods 1.6.1.
I have tried the following ->
deintegrating cocoapods from my project
cleaning the project
deleted ModuleCache and DerivedData
restarting my computer
This is the type of error I am getting ->
Module map file '/Users/kaunamohammed/Library/Developer/Xcode/DerivedData/OutNow-gxdxvzwmnijmrlajtbtyclkhrgqs/Build/Products/Debug-iphoneos/CodableFirebase/CodableFirebase.modulemap' not found
I expect my project to build properly but this is not the case and I am not sure what else to do.
This is what my Podfile looks like
platform :ios, '10.0'
workspace 'OutNow'
target 'OutNow' do
use_modular_headers!
#Pods for OutNow
pod 'Instabug'
pod 'SwiftMessages'
pod 'CodableFirebase'
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Storage'
pod 'Firebase/Firestore'
pod 'Firebase/Messaging'
pod 'Firebase/DynamicLinks'
pod 'MarqueeLabel/Swift'
pod 'RxSwift', '4.4.2'
pod 'RxCocoa', '4.4.2'
pod 'Kingfisher', '5.3.1'
pod 'InstantSearchClient', '6.0'
pod 'CoordinatorLibrary', '1.0.5'
pod 'UIScrollView-InfiniteScroll', '1.1.0'
target 'OutNowTests' do
inherit! :search_paths
# Pods for testing
end
end
In case it helps anyone else, I was able to solve this issue a different way. I was accidentally opening up my .xcproject instead of my .xcworkspace. When I opened the correct file, the error went away.
I fixed this problem myself. I can tell you what I did. Not sure which steps did it exactly, but below are all steps:
Copy the contents of your Podfile somewhere safe
Run: pod cache clean --all
Remove "Podfile"-file from the dir.
Xcode: Product > Clean Build Folder
Run: pod init. A new "Podfile"-file is added to the dir
Start adding parts of your original Podfile to this file
Run: pod install
Try to build your project again
In my case, I think the row use_frameworks! in the "Podfile" did the trick.
Hope this help you guys out!
I had this issue only when I wanted to make an archive. On the other hand, debug worked fine. After a while I noticed that min iOS version was different between my Target, Project and Podfile min iOS version. After syncing them all to same value (iOS 11) Xcode offered me Validate Project Settings - Update to recommended settings option which I accepted and I was able to archive my project.
I spent a whole day trying to figure out how to solve this issue. I was facing issue in my project on M1 machine.
I enabled "Open using Rosetta" option in Xcode and worked for me.
Here is how you do that:
Open Finder --> Applications --> Right click "Xcode" --> Get Info --> check "Open using Rosetta"
I solve this issue by removing OTHER_SWIFT_FLAGS custom flag in Swift Compiler - Custom Flags
OTHER_SWIFT_FLAGS = "$(inherited) -D COCOAPODS -Xcc -fmodule-map-file=\"${PODS_ROOT}/modulePath/moduleName.modulemap\"";
I faced this same issue but with Fastlane using gym build_app.
I ensured that min iOS version was synched between my Target, Project, and Podfile as mentioned by Josip B. This allowed me to archive my app using XCode but it still failed using Fastlane.
After lots of searching, it was able to resolve my issue by ensuring the IPHONEOS_DEPLOYMENT_TARGET version for each of my installed Pods inherited the version from my Podfile using this Podfile post-install script:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
end
end
end
Reference this post: https://stackoverflow.com/a/63489366/10211406
In case you are building on command line with xcodebuild, make sure you are using
xcodebuild -workspace ...
instead of just xcodebuild or
xcodebuild -project ...
I had this issue too, I'm not very familiar with XCode, but I opened the .xcodeworkspace file and then clicked build, which was successful!
It´ s a bit of a hack but try adding this in your podfile:
post_install do |installer|
installer.pods_project.targets.each do |target|
if (target.name&.eql?('FBReactNativeSpec'))
target.build_phases.each do |build_phase|
if (build_phase.respond_to?(:name) && build_phase.name.eql?('[CP-User] Generate Specs'))
target.build_phases.move(build_phase, 0)
end
end
end
end
make sure you add it to your bridge file, and Try to add this at the end of your podfile:
post_install do |installer_representation|
installer_representation.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
end
end

xcode PhaseScriptExecution failed with a nonzero exit code

/Users/xerasy/Library/Developer/Xcode/DerivedData/Opensoul-azlrvihpzjmefgdiufcpnucguxbp/Build/Intermediates.noindex/Opensoul.build/Release-iphonesimulator/Opensoul.build/Script-11B6BEDD1EFAB15300438DBB.sh: line 2: swiftgen: command not found
Command PhaseScriptExecution failed with a nonzero exit code
my podfile :
platform :ios, '10.0'
use_frameworks!
inhibit_all_warnings!
def shared_pods
pod 'Firebase/Core'
pod 'Firebase/Storage'
pod 'Firebase/Database'
pod 'Result'
pod 'Reusable'
pod 'PureLayout'
pod 'ObjectMapper'
pod 'Swinject'
end
target 'Opensoul' do
shared_pods
pod 'Fabric'
pod 'Crashlytics'
pod 'Toast'
target 'OpensoulTests' do
inherit! :search_paths
end
end
# target 'PlaygroundFramework' do
# shared_pods
# end
i tried
Go to keychain access -> right click on login -> lock & unlock again
-> clear Xcode project and make build again.
pod install
pod update
but nothing helped, how i can solve this problem ?
Currently my build is working. Here you are the steps I tried until it finally worked:
Search in the whole project the word CommonCrypto.
If you have a Pod containing that header import, remove this Pod from the Podfile and perform a pod install. Clean and build the project. Add again the Pod to the Podfile and perform a pod install.
Clean and build the
project again using a real device if possible.
And If you don't have that Pod, maybe you can try by making the same steps with some old Pod that you may encounter in your project.
Added information: also If you have some code error inside a Pod, first you need to solve that code problem and then try to compile again the project.
I'm going to copy the changes made in my project.pbxproj. I know it's not very helpful but it's the only thing that have changed in the git difference commit:
Removed: BDC9821B1E9BD1B600ADE0EF /* (null) in Sources */ = {isa = PBXBuildFile; };
Added: BDC9821B1E9BD1B600ADE0EF /* BuildFile in Sources */ = {isa = PBXBuildFile; };
Hope this is helpful for you...!

Linker Issue Xcode Cocoapods

Installed three pods but for some reason can't get it to work
I tried reinstalling, updating, deintegrating but nothing does it.
I get the following errors. Tried creating the folders manually but the Linker Error remains always
Podfile:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'Clima' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Clima
pod 'SwiftyJSON'
pod 'Alamofire'
pod 'SVProgressHUD'
end
The frameworks aren't being built. Just open {Yourproject}.xcworkspace generated after adding cocoapods instead of {Yourproject}.xcodeproj - that should help.

ld: framework not found Crashlytics Xcode7.2.1

I installed Fabric using CocoaPods.
My Podfile:
platform :ios, '8.0'
use_frameworks!
target '*****' do
pod 'GoogleMaps'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
pod 'Alamofire'
pod 'Google/Analytics', '~> 1.0.0'
pod 'Fabric'
pod 'Crashlytics'
end
target '****Tests' do
end
target '****UITests' do
end
post_install do |installer|
installer.pods_project.build_configuration_list.build_configurations.each do |configuration|
configuration.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
end
end
Add a Run Script Build Phase
"${PODS_ROOT}/Fabric/run" ****
Build Settings - Enable Bitcode - NO
I did Clean and Build
But I have mistake
ld: framework not found Crashlytics
clang: error: linker command failed with exit code 1 (use -v to see invocation)
If you check your project, you can see a folder called Pods right? There you can find a bunch of xcconfig files. You'll have to link them to your project's configurations.
See the image below:
Get rid of the extra paths I told you to add to the Framework search paths (sorry :P). And set the configuration files like this.