Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter 'Error running pod install' When I use 'flutter_barcode_scanner: ^1.0.1'

Tags:

flutter

When trying to run my flutter project I get:

Error running pod install

I've tried:

  • flutter clean
  • flutter upgrade

Everything in flutter doctor is good

iOS/Podfile: platform :ios, '9.0'

If I delete ' flutter_barcode_scanner: ^1.0.1 ' in pubspec.yaml it work so I think the problem from ' flutter_barcode_scanner: ^1.0.1 '

flutter run:

Launching lib/main.dart on iPhone1 in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: 7CQFF4JBHQ
Running pod install...
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 `flutter_barcode_scanner` from `.symlinks/plugins/flutter_barcode_scanner/ios`
-> Fetching podspec for `path_provider_linux` from `.symlinks/plugins/path_provider_linux/ios`
-> Fetching podspec for `shared_preferences` from `.symlinks/plugins/shared_preferences/ios`
-> Fetching podspec for `shared_preferences_linux` from `.symlinks/plugins/shared_preferences_linux/ios`
-> Fetching podspec for `shared_preferences_macos` from `.symlinks/plugins/shared_preferences_macos/ios`
-> Fetching podspec for `shared_preferences_web` from `.symlinks/plugins/shared_preferences_web/ios`

Resolving dependencies of `Podfile`
  CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only perfomed in repo update
[!] CocoaPods could not find compatible versions for pod "flutter_barcode_scanner":
  In Podfile:
    flutter_barcode_scanner (from `.symlinks/plugins/flutter_barcode_scanner/ios`)

Specs satisfying the `flutter_barcode_scanner (from `.symlinks/plugins/flutter_barcode_scanner/ios`)` dependency were found, but they required a higher minimum deployment target.

/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:328:in `raise_error_unless_state'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:310:in `block in unwind_for_conflict'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:308:in `tap'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:308:in `unwind_for_conflict'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:684:in `attempt_to_activate'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:254:in `process_topmost_state'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:182:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolver.rb:43:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/resolver.rb:94:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:1065:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:1063:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:410:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:235:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:234:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:156:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/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.9.3/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.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:
↳

[!] 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`.

Exception: Error running pod install

pubspec.yaml

version: 1.0.0+1

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  shared_preferences: ^0.5.8
  http: ^0.12.2
  flutter_barcode_scanner: ^1.0.1

  cupertino_icons: ^0.1.3

dev_dependencies:
  flutter_test:
    sdk: flutter
like image 651
Bob Lee Avatar asked Aug 06 '20 12:08

Bob Lee


2 Answers

The plugin requires you to set your ios deployment target to 11

from the plugin's docs

iOS - Requires Swift support

Deployment target : 11

To solve this, open your Podfile at ios/Podfile and change the deployment target to 11.

change the second line of your Podfile from

# platform :ios, '9.0'

to

platform :ios, '11.0'

make sure it's not commented i.e there's no # in front of the line

like image 177
JideGuru Avatar answered Sep 20 '22 05:09

JideGuru


In Flutter project, I Also faced with this issue. Fixed by doing those steps, (FYI- I used flutter_barcode_scanner: ^2.0.0)

1st step :- run this commands

flutter clean
rm -Rf ios/Pods
rm -Rf ios/.symlinks
rm -Rf ios/Flutter/Flutter.framework
rm -Rf ios/Flutter/Flutter.podspec
flutter pub get

this can be do manually , go to ios/Podfile and delete Pods, Podfile and Podfile.lock. then run flutter pub get

2nd step :- using code editor, open your Podfile at ios/Podfile and change the # platform :ios, '9.0' to platform :ios, '12.0'

3rd step :- run this commands

cd ios
pod install
cd ..

4th step :- open your project in Xcode and change iOS Deployment Target to 12.1 ios Deployment Target to 12.1

5th step :-

enter image description here

Last Step :- Now you can run flutter build ios or flutter run

like image 33
Vidura Silva Avatar answered Sep 22 '22 05:09

Vidura Silva