Flutter gives error "Error running pod install" - flutter

I get the below error/log when i implement the google_sign_in package to my flutter application.
I'm using m1 chip. all the packages, flutter framework and xcode at their last versions.
Flutter project dependencies:
http: ^0.13.4
firebase_auth: ^3.3.6
google_sign_in: ^5.2.3
At the first i got this:
Error output from CocoaPods:
↳
[!] Automatically assigning platform `iOS` with version `9.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
Then I've uncomment this platform :ios, '9.0' at ios/Podfile
But different error shows up like this:
Launching lib/main.dart on iPhone 13 in debug mode...
lib/main.dart:1
CocoaPods' output:
↳
Preparing
Analyzing dependencies
Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
Fetching external sources
-> Fetching podspec for `Flutter` from `Flutter`
-> Fetching podspec for `firebase_auth` from `.symlinks/plugins/firebase_auth/ios`
firebase_auth: Using Firebase SDK version '8.11.0' defined in 'firebase_core'
-> Fetching podspec for `firebase_core` from `.symlinks/plugins/firebase_core/ios`
firebase_core: Using Firebase SDK version '8.11.0' defined in 'firebase_core'
-> Fetching podspec for `google_sign_in` from `.symlinks/plugins/google_sign_in/ios`
Resolving dependencies of `Podfile`
Error output from CocoaPods:
↳
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle, 0x0009): tried: '/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle' **(mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))**, '/usr/lib/ffi_c.bundle' (no such file) - /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi.rb:5:in `rescue in '
from /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi.rb:2:in `'
2
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Library/Ruby/Gems/2.6.0/gems/ethon-0.15.0/lib/ethon.rb:3:in `'
2
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Library/Ruby/Gems/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `'
2
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
...
I think because of the m1 chip that i using, according to this error message (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
Does anyone have an idea about this issue?
Also, the below subjects' answers didn't work for me.
Flutter Error running pod install After Upgrading Flutter version
Flutter pod install issue and ios app not running
https://github.com/CocoaPods/CocoaPods/issues/10127#issuecomment-705741320

Use these commands in your project files to manually install pod files:
cd ios
arch -x86_64 pod install
cd ..
flutter run

run this code on your terminal
sudo arch -x86_64 gem install ffi
Next, go to the ios folder in your project, and open Podfile.
Change the 9.0 to 10.0, as the below
platform :ios, '10.0'

I had the same problem
Here is my solution.
open 'ISO foler' with Xcode
click Runner folder at top, and copy bundle identifier
go to firebase website and start IOS connection
paste the copied identifier and click next
download the plist file and move to runner folder
go to ios folder
arch -x86_64 pod install
cd ..
flutter run
The point is that you should manually connect firebase to flutter. I used the flutter connection thing that firebase recently added. But it has some glitch I guess.

install boringssl-grpc
which can solve the probe

Related

"pod install" command is not working in terminal in Android Studio Arctic Fox mac m1

I am using Arctic Fox 2020.3.1 (ARM version- designed for Apple silicon), on Macbook Air M1 2020 model, running flutter project. I am successfully able to run on Android emulator, but when i try to run on attached iOS device or iOS simulator "pod install" command fails and build failed. But when i open my terminal on rosetta 2 and try "pod install" manually it install all pods, and after that i am able to run the build from XCODE but not from Android Studio, so my question is: Is terminal inside Android Studio runs on Apple (not on rosetta 2) that's why it fails.
Note: I have changed the configuration of terminal to run it forcefully on rosetta 2.
This happens when i try to run for ios from studio
The plugins `flutter_full_pdf_viewer, flutter_webview_plugin, onesignal_flutter` use a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if these plugins support the Android V2 embedding. Otherwise, consider removing them since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.
Launching lib/main.dart on Lakhwinder’s iPhone in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: E942NB2Q9L
Running pod install...
CocoaPods' output:
↳
CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only performed in repo update
Error output from CocoaPods:
↳
WARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
Consider adding the following to ~/.profile:
export LANG=en_US.UTF-8
/opt/homebrew/Cellar/ruby/3.0.2/lib/ruby/3.0.0/unicode_normalize/normalize.rb:141:in `normalize': Unicode Normalization not appropriate for ASCII-8BIT (Encoding::CompatibilityError)
from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:166:in `unicode_normalize'
from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:166:in `installation_root'
from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:226:in `podfile_path'
from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/user_interface/error_report.rb:105:in `markdown_podfile'
from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/user_interface/error_report.rb:30:in `report'
from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:66:in `report_error'
from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/claide-1.0.3/lib/claide/command.rb:396:in `handle_exception'
from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/claide-1.0.3/lib/claide/command.rb:337:in `rescue in run'
from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/claide-1.0.3/lib/claide/command.rb:324:in `run'
from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:52:in `run'
from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/bin/pod:55:in `<top (required)>'
from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/bin/pod:23:in `load'
from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/bin/pod:23:in `<main>'
/opt/homebrew/Cellar/ruby/3.0.2/lib/ruby/3.0.0/unicode_normalize/normalize.rb:141:in `normalize': Unicode Normalization not appropriate for ASCII-8BIT (Encoding::CompatibilityError)
from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:166:in `unicode_normalize'
from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:166:in `installation_root'
from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:226:in `podfile_path'
from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:205:in `podfile'
from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:160:in `verify_podfile_exists!'
from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/command/install.rb:46:in `run'
from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:52:in `run'
from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/bin/pod:55:in `<top (required)>'
from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/bin/pod:23:in `load'
from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/bin/pod:23:in `<main>'
Exception: Error running pod install
open Terminal type open ~/.zshrc (or .profile if you don't use zsh)
It seems that LANG="en_US.UTF-8" alone isn't enough, you have to set
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
save the file
go back to Terminal
type source ~/.zshrc
type locale
You can now safely run pod update or pod install
You may have to install ffi. Run sudo gem install ffi then normal flutter run should work as expected.

Unable to read the license file `../LICENSE` for the spec `integration_test

I use Flutter with Android studio and when I run
The Error output from CocoaPods is shown as below
Do you know how to solve the problem?
[Screen shot of Android studio]
Launching lib/main.dart on iPhone 8 in debug mode...
Running pod install...
CocoaPods' output:
↳
Preparing
.
.
.
.
.
Error output from CocoaPods:
↳
[!] Automatically assigning platform `ios` with version `9.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
[!] A license was specified in podspec `integration_test` but the file does not exist - /Users/a/AndroidStudioProjects/flutter_app5/ios/.symlinks/plugins/integration_test/LICENSE
[!] Unable to read the license file `../LICENSE` for the spec `integration_test (0.0.1)`
[!] Unable to read the license file `../LICENSE` for the spec `integration_test (0.0.1)`
Error running pod install
Error launching application on iPhone 8.
I have exactly the same issue. The first of them I was able to solve:
open your project's Podfile which is located in your project's ios folder and remove the comments in line 2 to e.g.
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
First at all, if you use flutter in dev or beta channel, should change it to master or stable.
If not, to resolve first issue, open ios/Podfile and uncomment second line
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
to resolve another issues which relative with integration_test, a simple way is just remove it, open pubspec.yaml, remove below code
integration_test:
sdk: flutter
and give it a try.

How to solve error running pod install on Iphone 11 on flutter

I know that there are many similar questions about this problem, I try them all but didn't work.
The problem started after trying to run the code on Xcode on a physical device.
The error is below whe I say on the command line "flutter run".
Running pod install... 1,234ms
CocoaPods' output:
↳
Preparing
Analyzing dependencies
Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
Finding Podfile changes
- Flutter
- flutter_secure_storage
- local_auth
- shared_preferences
- vibration
Fetching external sources
-> Fetching podspec for `Flutter` from `Flutter`
-> Fetching podspec for `flutter_secure_storage` from `.symlinks/plugins/flutter_secure_storage/ios`
-> Fetching podspec for `local_auth` from `.symlinks/plugins/local_auth/ios`
-> Fetching podspec for `shared_preferences` from `.symlinks/plugins/shared_preferences/ios`
-> Fetching podspec for `vibration` from `.symlinks/plugins/vibration/ios`
Resolving dependencies of `Podfile`
CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only perfomed in repo update
Comparing resolved specification to the sandbox manifest
A Flutter
A flutter_secure_storage
A local_auth
A shared_preferences
A vibration
Downloading dependencies
-> Installing Flutter (1.0.0)
-> Installing flutter_secure_storage (3.3.1)
-> Installing local_auth (0.0.1)
-> Installing shared_preferences (0.0.1)
-> Installing vibration (1.7.2)
- Running pre install hooks
[!] The 'Pods-Runner' target has transitive dependencies that include statically linked binaries:
(/Users/ilkerimamoglu/Desktop/Flutter_MQTT-master 3 copy/ios/Flutter/Flutter.framework)
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/target_validator.rb:84:in `block (2 levels) in
verify_no_static_framework_transitive_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/target_validator.rb:74:in `each_key'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/target_validator.rb:74:in `block in
verify_no_static_framework_transitive_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/target_validator.rb:73:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/target_validator.rb:73:in
`verify_no_static_framework_transitive_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/target_validator.rb:38:in `validate!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:595:in `validate_targets'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:162:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
Error running pod install
Error launching application on iPhone 11.
Even I didn't do something else, it gives me this error. I tried to delete Flutter.framework and run pod install but it is giving me [!] No `Podfile' found in the project directory.
What can I do?
I met the same situation. And this is the solution I found.
https://armen-mkrtchian.medium.com/run-cocoapods-on-apple-silicon-and-macos-big-sur-developer-transition-kit-b62acffc1387
Basically:
Locate Terminal.app in Finder. (Applications->Terminal.app)
Right-click and choose Get Info
Check the “Open using Rosetta”
Quit all instances of Terminal app and run it again
Run sudo gem install ffi
After you finish the above several steps, restart your IDE and re-run the application.

Flutter: Can't create plugin packages

I'm trying to create a plugin package in order to access some specific hardware APIs, both in Android (using Kotlin) and in iOS (using Swift). To that end, I was trying to follow the instructions here:
https://flutter.dev/docs/development/packages-and-plugins/developing-packages
I'm right now only working on the Swift side of the problem, so what has been done so far is the following:
1) Went to the directory where other Dart packages live (which are non-Flutter ones, and which work perfectly okay) and ran:
flutter create --org com.example --template=plugin my_plugin
That created the whole thing as described in the documentation, and no error was reported.
2) Then, as stated in the previous link, I went to my_plugin/example and ran flutter build ios --no-codesign, with the following (apparently okay?) output:
Warning: Building for device with codesigning disabled. You will have to manually codesign before deploying to device.
Building com.example.myPluginExample for device (ios-release)...
Running pod install... 6.5s
├─Building Dart code... 2.9s
├─Generating dSYM file... 1.0s
├─Stripping debug symbols... 0.6s
├─Assembling Flutter resources... 1.0s
└─Compiling, linking and signing... 9.0s
Xcode build done. 19.8s
3) So now with the plugin just created, tried to add it to the main project and thus, in its pubspec.yaml file, inserted the following lines (the plugin is located in ../pkgs with respect to the Flutter application I'm working in:
dependencies:
flutter:
sdk: flutter
my_plugin:
path: ../pkgs/my_plugin
4) Now just tried to run the Flutter application both in a physical device and in the simulator, and the following error always showed up:
Launching lib/main.dart on iPhone Xʀ in debug mode...
CocoaPods' output:
↳
Preparing
Analyzing dependencies
Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
Finding Podfile changes
A my_plugin
- Flutter
Fetching external sources
-> Fetching podspec for `Flutter` from `.symlinks/flutter/ios`
-> Fetching podspec for `my_plugin` from `.symlinks/plugins/my_plugin/ios`
Resolving dependencies of `Podfile`
Comparing resolved specification to the sandbox manifest
A Flutter
A my_plugin
Downloading dependencies
-> Installing Flutter (1.0.0)
-> Installing my_plugin (0.0.1)
- Running pre install hooks
[!] Unable to determine Swift version for the following pods:
- `my_plugin` does not specify a Swift version and none of the targets (`Runner`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/installer/xcode/target_validator.rb:115:in `verify_swift_pods_swift_version'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/installer/xcode/target_validator.rb:37:in `validate!'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/installer.rb:459:in `validate_targets'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/installer.rb:138:in `install!'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/command/install.rb:48:in `run'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/command.rb:52:in `run'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/bin/pod:55:in `<top (required)>'
/usr/local/Cellar/cocoapods/1.6.1/libexec/bin/pod:22:in `load'
/usr/local/Cellar/cocoapods/1.6.1/libexec/bin/pod:22:in `<main>'
Error output from CocoaPods:
↳
WARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
Consider adding the following to ~/.profile:
export LANG=en_US.UTF-8
Error running pod install
Error launching application on iPhone Xʀ.
Exited (sigterm)
5) I tried to fix it by adding the following line to the only 2 Podfile files that I can see in my whole directory structure (the one that belongs to the app and the one that belongs to the new plugin "example" -both files automatically created by Flutter's tools and both not having received any edit until today-):
config.build_settings['SWIFT_VERSION'] = '4.1'
(that idea was taken from https://stackoverflow.com/a/52194702/6348097, and yes: I tried at least one different version number). The error is still the same.
The resulting plugin's Podfile is:
platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def parse_KV_file(file, separator='=')
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=separator)
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
use_frameworks!
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
# Flutter Pods
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 packages get is executed first."
end
generated_xcode_build_settings.map { |p|
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
symlink = File.join('.symlinks', 'flutter')
File.symlink(File.dirname(p[:path]), symlink)
pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
end
}
# Plugin Pods
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.map { |p|
symlink = File.join('.symlinks', 'plugins', p[:name])
File.symlink(p[:path], symlink)
pod p[:name], :path => File.join(symlink, 'ios')
}
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.1'
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
I did the same adding to the Flutter app's Podfile. Also, the first line where the iOS platform was specified, was originally commented (and that was generating a warning) so I also uncommented that line from both podfiles.
This is the output of flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.2.1, on Mac OS X 10.14.3 18D109, locale en-ES)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 10.2)
[✓] Android Studio (version 3.3)
[✓] VS Code (version 1.33.1)
[✓] Connected device (1 available)
• No issues found!
The question is just how to make this work. I did not even started adding my own code, but I'm stuck with the very basic Flutter's plugin creation tool. Also, I have no idea why I need all that dirty and complex example subdir in my package (so as a secondary question that is not really important: can I just remove it once this works?)
EDIT: I did another test: created an empty app using VSC's "Flutter: New Project" command (which creates the "Flutter 101" increment-a-counter example). Then followed again the steps described above in order to create the plugin package, and got the same error when included that package on the newly created project and ran it in the iOS simulator. So there is absolutely no code from me there, except for having added the new plugin as a dependency to the example app.
Try to open the IOS project in the folder ios/Runner/Runner.xcworkspac with Xcode. Then create / add a new Swift file anywhere in that directory. Xcode will then automatically apply changes needed to your support your swift part of your flutter app.
The other thing could be that your PodFile was modified somehow: try to compare it to Google's master PodFile through this link: PodFile Master File
After having tried several things, none of which worked, I found this solution on a GitHub thread:
https://github.com/ko2ic/image_downloader/issues/9#issuecomment-471608482
Having followed these steps strictly, did finally work.
A few interesting thing were:
I also tried to create the plugin from Android Studio (instead of from the command line or from VSC). It did not work without the steps described in the previous link, but the steps were finally done on that Android Studio created plugin (so I just don't know if this would work with a VSC created plugin, must I would say that most likely yes, since I did not see any difference on the outcome of the commands). I mention this because this answer was suggesting that that may fix the problem: https://stackoverflow.com/a/54919007/6348097
There are 2 Podfile files in the sources: one for the plugin, and another one for the app itself. I modified both and I opened both XCode (automaticall generated) projects.
I also added the following line to the Podfile: config.build_settings['SWIFT_VERSION'] = '4.2', right before the only occurrence of the following line: config.build_settings['ENABLE_BITCODE'] = 'NO'
In both Podfile files, uncommented the platform :ios, '8.0', and changed the versino to 9.0. This did not solve the problem, but at some point fixed a warning when running pod install

Create Flutter Plugin with pod dependencies

I created a flutter plugin with "FacebookShare" dependency.
My pod spec like below,
Pod::Spec.new do |s|
s.name = '{plugin name}'
s.version = '0.0.2'
s.summary = 'A new Flutter plugin for share image and text in social media'
s.description = <<-DESC A new Flutter plugin for share image and text in social media
DESC
s.homepage = 'https://github.com/jayarajm/flutter_share_social_media.git'
s.license = { :file => '../LICENSE' }
s.author = { '...' => '...' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.public_header_files = 'Classes/**/*.h'
s.dependency 'Flutter'
s.dependency 'FacebookShare'
s.ios.deployment_target = '8.0'
s.static_framework = true
end
In the sample project, the plugin refers to a local path. So I didn't receive any problem to install pod or run the project.
After publish into "https://pub.dartlang.org/".
I try to use from dart packages in my project, I received a problem in installing pod. I attached the error below,
CocoaPods' output:
↳
Preparing
Analyzing dependencies
Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
Fetching external sources
-> Fetching podspec for `Flutter` from `.symlinks/flutter/ios`
-> Fetching podspec for `flutter_share_social_media` from `.symlinks/plugins/flutter_share_social_media/ios`
Resolving dependencies of `Podfile`
Comparing resolved specification to the sandbox manifest
A Bolts
A FBSDKCoreKit
A FBSDKShareKit
A FacebookCore
A FacebookShare
A Flutter
A flutter_share_social_media
Downloading dependencies
-> Installing Bolts (1.9.0)
> Copying Bolts from `/Users/jayaraj_m/Library/Caches/CocoaPods/Pods/Release/Bolts/1.9.0-ac656` to `Pods/Bolts`
-> Installing FBSDKCoreKit (4.40.0)
> Copying FBSDKCoreKit from `/Users/jayaraj_m/Library/Caches/CocoaPods/Pods/Release/FBSDKCoreKit/4.40.0-ae214` to `Pods/FBSDKCoreKit`
-> Installing FBSDKShareKit (4.40.0)
> Copying FBSDKShareKit from `/Users/jayaraj_m/Library/Caches/CocoaPods/Pods/Release/FBSDKShareKit/4.40.0-0e459` to `Pods/FBSDKShareKit`
-> Installing FacebookCore (0.5.0)
> Copying FacebookCore from `/Users/jayaraj_m/Library/Caches/CocoaPods/Pods/Release/FacebookCore/0.5.0-74288` to `Pods/FacebookCore`
-> Installing FacebookShare (0.5.0)
> Copying FacebookShare from `/Users/jayaraj_m/Library/Caches/CocoaPods/Pods/Release/FacebookShare/0.5.0-963b4` to `Pods/FacebookShare`
-> Installing Flutter (1.0.0)
-> Installing flutter_share_social_media (0.0.2)
- Running pre install hooks
[!] The following Swift pods cannot yet be integrated as static libraries:
The Swift pod `FacebookCore` depends upon `Bolts` and `FBSDKCoreKit`, which do not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.
The Swift pod `FacebookShare` depends upon `Bolts`, `FBSDKCoreKit`, and `FBSDKShareKit`, which do not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.
The Swift pod `flutter_share_social_media` depends upon `Bolts`, `FBSDKCoreKit`, and `FBSDKShareKit`, which do not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.
/usr/local/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/target_validator.rb:135:in `verify_swift_pods_have_module_dependencies'
/usr/local/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/target_validator.rb:38:in `validate!'
/usr/local/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:415:in `validate_targets'
/usr/local/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:118:in `install!'
/usr/local/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/command/install.rb:41:in `run'
/usr/local/lib/ruby/gems/2.5.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/usr/local/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:52:in `run'
/usr/local/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
Error output from CocoaPods:
↳
[!] `<PBXGroup UUID=`97C146E51CF9000F007C117D`>` attempted to initialize an object with an unknown UUID. `CF3B75C9A7D2FA2A4C99F110` for attribute: `children`. This can be the result of a merge and the unknown UUID is being discarded.
[!] Automatically assigning platform `ios` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
I'd a similar problem, with the same output <PBXGroup UUID..., in my case when I ran pod install --verbose I realize that there was an specific error during pod install
undefined method `each_child' for #Dir:0x00007ff10befa7f0 Did you mean? each_slice
Looking for this specific error I found this answer and I realize that I was using ruby 2.5 and one file generated by Flutter for iOS devices was trying to use a method that was introduced on version 2.6.
After follow the steps on that answer I could run my Flutter app on iOS simulator.
The method dir.each_child was introduced in Ruby 2.6, but you are using Ruby 2.3.0.
You should update Ruby to 2.6.0 or later 2.x version.
After Ruby updating you may also need to restart your IDE and re-install cocoapods.