无效的“Podfile”文件:无法加载此类文件。/flutter/packages/flutter_tools/bin/podhelper

Rya*_*dea 8 ios cocoapods flutter

当我升级flutter后尝试用模拟器测试flutter项目时,出现了这个错误。

\n
Launching lib/main.dart on iPhone 11 Pro in debug mode...\nRunning pod install...                                              1.1s\nCocoaPods' output:\n\xe2\x86\xb3\n    [!] Invalid `Podfile` file: cannot load such file -- /Volumes/WD /DEVELOPER/flutter/packages/flutter_tools/bin/podhelper.\n     #  from /Volumes/WD/DEVELOPER/dont_forget/ios/Podfile:26\n     #  -------------------------------------------\n     #\n     >  require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)\n     #\n     #  -------------------------------------------\n    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0.beta.2/lib/cocoapods-core/podfile.rb:318:in `rescue in block in from_ruby'\n    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0.beta.2/lib/cocoapods-core/podfile.rb:312:in `block in from_ruby'\n    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0.beta.2/lib/cocoapods-core/podfile.rb:50:in `instance_eval'\n    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0.beta.2/lib/cocoapods-core/podfile.rb:50:in `initialize'\n    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0.beta.2/lib/cocoapods-core/podfile.rb:310:in `new'\n    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0.beta.2/lib/cocoapods-core/podfile.rb:310:in `from_ruby'\n    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0.beta.2/lib/cocoapods-core/podfile.rb:276:in `from_file'\n    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.2/lib/cocoapods/config.rb:205:in `podfile'\n    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.2/lib/cocoapods/command.rb:160:in `verify_podfile_exists!'\n    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.2/lib/cocoapods/command/install.rb:46:in `run'\n    /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'\n    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.2/lib/cocoapods/command.rb:52:in `run'\n    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0.beta.2/bin/pod:55:in `<top (required)>'\n    /usr/local/bin/pod:23:in `load'\n    /usr/local/bin/pod:23:in `<main>'\nError running pod install\nError launching application on iPhone 11 Pro.\nExited (sigterm)\n
Run Code Online (Sandbox Code Playgroud)\n

我尝试过flutter cleanflutter build iOSrm iOS/Podfile根本没用。我该如何解决这个问题?这是我的flutter doctorflutter --version下面的。

\n
Doctor summary (to see all details, run flutter doctor -v):\n[\xe2\x9c\x93] Flutter (Channel stable, 1.20.2, on Mac OS X 10.15.5 19F101, locale en-KR)\n \n[\xe2\x9c\x93] Android toolchain - develop for Android devices (Android SDK version 30.0.1)\n[\xe2\x9c\x93] Xcode - develop for iOS and macOS (Xcode 11.6)\n[\xe2\x9c\x93] Android Studio (version 4.0)\n[\xe2\x9c\x93] VS Code (version 1.48.1)\n[\xe2\x9c\x93] Connected device (1 available)\n\n\xe2\x80\xa2 No issues found!\n
Run Code Online (Sandbox Code Playgroud)\n
Flutter 1.20.2 \xe2\x80\xa2 channel stable \xe2\x80\xa2 https://github.com/flutter/flutter.git\nFramework \xe2\x80\xa2 revision bbfbf1770c (10 days ago) \xe2\x80\xa2 2020-08-13 08:33:09 -0700\nEngine \xe2\x80\xa2 revision 9d5b21729f\nTools \xe2\x80\xa2 Dart 2.9.1\n
Run Code Online (Sandbox Code Playgroud)\n

yen*_*dis 25

从终端运行:

flutter clean

flutter pub get

pod install// cd 进入ios文件夹


Rya*_*dea 1

哦,我意识到发生这种情况是因为我通过 Xcode 更改了我的应用程序名称,所以我将以前的 pod 文件放回文件夹并按照https://github.com/flutter/flutter/issues/25370#issuecomment-540947710iOS的方式进行操作 ,然后,它就像魅力一样!希望对您有帮助。