当尝试运行我的flutter项目时,我得到:
运行Pod安装时出错
(我看到了另一个非常相似的post,但不确定是否存在相同的问题。)
我正在macOS Mojave 10.14.6版上用Flutter编写Dart代码。
我尝试过:
flutter clean
flutter doctor
flutter upgrade
flutter run
我已经尝试过上述命令的每种可能组合中的每个flutter命令,但仍然会遇到相同的错误。
颤抖的医生:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v1.9.1+hotfix.4, on Mac OS X 10.14.6 18G103, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.0)
[✓] Android Studio (version 3.5)
[✓] IntelliJ IDEA Ultimate Edition (version 2019.1.2)
[✓] Connected device (1 available)
• No issues found!
颤动运行:
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Running pod install... 1.3s
CocoaPods' output:
↳
Preparing
Analyzing dependencies
Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
Finding Podfile changes
M Flutter
- barcode_scan
- flutter_webview_plugin
- google_sign_in
- path_provider
- shared_preferences
- sqflite
- url_launcher
Fetching external sources
-> Fetching podspec for `Flutter` from `.symlinks/flutter/ios`
-> Fetching podspec for `barcode_scan` from
`.symlinks/plugins/barcode_scan/ios`
-> Fetching podspec for `flutter_webview_plugin` from
`.symlinks/plugins/flutter_webview_plugin/ios`
-> Fetching podspec for `google_sign_in` from
`.symlinks/plugins/google_sign_in/ios`
-> Fetching podspec for `path_provider` from
`.symlinks/plugins/path_provider/ios`
-> Fetching podspec for `shared_preferences` from
`.symlinks/plugins/shared_preferences/ios`
-> Fetching podspec for `sqflite` from `.symlinks/plugins/sqflite/ios`
-> Fetching podspec for `url_launcher` from
`.symlinks/plugins/url_launcher/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 FMDB
A Flutter
A GTMSessionFetcher
A GoogleSignIn
A GoogleToolboxForMac
A MTBBarcodeScanner
A barcode_scan
A flutter_webview_plugin
A google_sign_in
A path_provider
A shared_preferences
A sqflite
A url_launcher
Downloading dependencies
-> Installing FMDB (2.7.5)
> Copying FMDB from
`~/Library/Caches/CocoaPods/Pods/Release/FMDB/2.7.5-2ce
00` to `Pods/FMDB`
-> Installing Flutter (1.0.0)
-> Installing GTMSessionFetcher (1.2.2)
> Copying GTMSessionFetcher from
`~/Caches/CocoaPods/Pods/Release/GTMSessionFetc
her/1.2.2-61bb0` to `Pods/GTMSessionFetcher`
-> Installing GoogleSignIn (4.4.0)
> Copying GoogleSignIn from
`~/Library/Caches/CocoaPods/Pods/Release/GoogleSignIn/4
.4.0-7ff24` to `Pods/GoogleSignIn`
-> Installing GoogleToolboxForMac (2.2.1)
> Copying GoogleToolboxForMac from
`~/Library/Caches/CocoaPods/Pods/Release/GoogleToolboxF
orMac/2.2.1-b3553` to `Pods/GoogleToolboxForMac`
-> Installing MTBBarcodeScanner (5.0.11)
> Copying MTBBarcodeScanner from
`~/Library/Caches/CocoaPods/Pods/Release/MTBBarcodeScan
ner/5.0.11-f453b` to `Pods/MTBBarcodeScanner`
-> Installing barcode_scan (0.0.1)
-> Installing flutter_webview_plugin (0.0.1)
-> Installing google_sign_in (0.0.1)
-> Installing path_provider (0.0.1)
-> Installing shared_preferences (0.0.1)
-> Installing sqflite (0.0.1)
-> Installing url_launcher (0.0.1)
- Running pre install hooks
[!] The 'Pods-Runner' target has transitive dependencies that include
statically linked binaries:
(<flutter_project_repo>/ios/.symlinks/flutter/ios/Flutte
r.framework)
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.1/lib/cocoapods/installer/xcode/
target_validator.rb:84:in `block (2 levels) in
verify_no_static_framework_transitive_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.1/lib/cocoapods/installer/xcode/
target_validator.rb:74:in `each_key'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.1/lib/cocoapods/installer/xcode/
target_validator.rb:74:in `block in
verify_no_static_framework_transitive_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.1/lib/cocoapods/installer/xcode/
target_validator.rb:73:in `each'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.1/lib/cocoapods/installer/xcode/
target_validator.rb:73:in
`verify_no_static_framework_transitive_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.1/lib/cocoapods/installer/xcode/
target_validator.rb:38:in `validate!'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.1/lib/cocoapods/installer.rb:590
:in `validate_targets'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.1/lib/cocoapods/installer.rb:158
:in `install!'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.1/lib/cocoapods/command/install.
rb:52:in `run'
/Library/Ruby/Gems/2.3.0/gems/claide-1.0.3/lib/claide/command.rb:334:in
`run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.1/lib/cocoapods/command.rb:52:in
`run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.1/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`.
Error running pod install
Error launching application on iPhone 11 Pro Max.
我还更新了许多不同的程序,例如可可豆和红宝石。
我认为这与以下安装之一有关:
-> Installing MTBBarcodeScanner (5.0.11)
> Copying MTBBarcodeScanner from
`~/Library/Caches/CocoaPods/Pods/Release/MTBBarcodeScan
ner/5.0.11-f453b` to `Pods/MTBBarcodeScanner`
-> Installing barcode_scan (0.0.1)
因为它使用了我的pubspec.yaml中的版本, 然后出于某种原因就开始使用0.0.1。
pubspec.yaml
...
version: 1.0.0+1
environment:
sdk: ">=2.2.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
easy_localization: ^1.3.1
...
flutter run
Error running pod install
不知道我还能做什么以获得更好的错误消息...
答案 0 :(得分:11)
您可以在消息中看到错误
[!] 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.
因此,转到项目内的文件ios/Podfile
,在其中找到行
# platform :ios, '9.0'
并取消注释。
之后,删除ios/Podfile.lock
文件并再次运行项目(或pod update
)
答案 1 :(得分:1)
看起来像来自CocoaPods的错误提示您添加如下一行:
添加到Flutter应用目录的ios/Podfile
顶部
platform :ios, '9.0'
从ios文件夹中删除podfile.lock
文件。
运行pod install
如果pod install
出现任何错误,请尝试
pod install --repo-update
flutter run
答案 2 :(得分:0)