我有 Mac 并使用 Android Studio 和 Xcode,當我嘗試運行我的 Flutter 應用程式或嘗試執行 Build -> Build iOS 時收到以下錯誤訊息 我嘗試了我在網路上找到的大多數解決方案,例如:pod install or remove檔案,,和其他解決方案,但沒有幫助我,如何解決?謝謝
Could not build the precompiled application for the device.
Error (Xcode): 'Flutter/Flutter.h' file not found
/Users/test/StudioProjects/app/ios/Runner/GeneratedPluginRegistrant.h:9:8
Error (Xcode): failed to emit precompiled header '/Users/test/Library/Developer/Xcode/DerivedData/Runner-dmjvwbvrfekhkvanzgfshfxgayly/Build/Intermediates.noindex/PrecompiledHeaders/Runner-Bridging-Header-swift_3KZJBW1LQ4BLG-clang_3S6LL1PRJK0WS.pch' for bridging header '/Users/test/StudioProjects/app/ios/Runner/Runner-Bridging-Header.h'
Error launching application
和顫振醫生在這里:
/Users/test/Downloads/flutter/bin/flutter doctor --verbose
[?] Flutter (Channel stable, 2.10.1, on macOS 12.2.1 21D62 darwin-x64, locale sv-SE)
? Flutter version 2.10.1 at /Users/test/Downloads/flutter
? Upstream repository https://github.com/flutter/flutter.git
? Framework revision db747aa133 (5 days ago), 2022-02-09 13:57:35 -0600
? Engine revision ab46186b24
? Dart version 2.16.1
? DevTools version 2.9.2
[!] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
? Android SDK at /Users/test/Library/Android/sdk
? cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
? Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[?] Xcode - develop for iOS and macOS (Xcode 13.2.1)
? Xcode at /Applications/Xcode.app/Contents/Developer
? CocoaPods version 1.11.2
[?] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[?] Android Studio (version 2021.1)
? Android Studio at /Applications/Android Studio.app/Contents
? Flutter plugin can be installed from:
?? https://plugins.jetbrains.com/plugin/9212-flutter
? Dart plugin can be installed from:
?? https://plugins.jetbrains.com/plugin/6351-dart
? Java version OpenJDK Runtime Environment (build 11.0.11 0-b60-7590822)
[!] Connected device
! No devices available
[?] HTTP Host Availability
? All required HTTP hosts are available
! Doctor found issues in 3 categories.
Process finished with exit code 0
顫振 -v
Manage your Flutter app development.
Common commands:
flutter create <output directory>
Create a new Flutter project in the specified directory.
flutter run [options]
Run your Flutter application on an attached device or in an emulator.
Usage: flutter <command> [arguments]
Global options:
-h, --help Print this usage information.
-v, --verbose Noisy logging, including all shell commands executed.
If used with "--help", shows hidden options. If used with "flutter doctor", shows additional diagnostic information. (Use "-vv" to force
verbose logging in those cases.)
--prefixed-errors Causes lines sent to stderr to be prefixed with "ERROR:".
--quiet Reduce the amount of output from some commands.
--[no-]wrap Toggles output word wrapping, regardless of whether or not the output is a terminal.
(defaults to on)
--wrap-column Sets the output wrap column. If not set, uses the width of the terminal. No wrapping occurs if not writing to a terminal. Use "--no-wrap" to
turn off wrapping when connected to a terminal.
-d, --device-id Target device id or name (prefixes allowed).
--version Reports the version of this tool.
--machine When used with the "--version" flag, outputs the information using JSON.
--[no-]color Whether to use terminal colors (requires support for ANSI escape sequences).
(defaults to on)
--[no-]version-check Allow Flutter to check for updates when this command runs.
(defaults to on)
--suppress-analytics Suppress analytics reporting when this command runs.
--packages Path to your "package_config.json" file.
Local build selection options (not normally required):
--local-engine-src-path Path to your engine src directory, if you are building Flutter locally.
Defaults to $FLUTTER_ENGINE if set, otherwise defaults to the path given in your pubspec.yaml dependency_overrides for sky_engine, if any.
--local-engine Name of a build output within the engine out directory, if you are building Flutter locally.
Use this to select a specific version of the engine if you have built multiple engine targets.
This path is relative to "--local-engine-src-path" or "--local-engine-src-out" (q.v.).
Options for testing the "flutter" tool itself:
--show-test-device List the special "flutter-tester" device in device listings. This headless device is used to test Flutter tooling.
--show-web-server-device List the special "web-server" device in device listings.
Available commands:
Flutter SDK
bash-completion Output command line shell completion setup scripts.
channel List or switch Flutter channels.
config Configure Flutter settings.
doctor Show information about the installed tooling.
downgrade Downgrade Flutter to the last active version for the current channel.
precache Populate the Flutter tool's cache of binary artifacts.
upgrade Upgrade your copy of Flutter.
Project
analyze Analyze the project's Dart code.
assemble Assemble and build Flutter resources.
build Build an executable app or install bundle.
clean Delete the build/ and .dart_tool/ directories.
create Create a new Flutter project.
drive Run integration tests for the project on an attached device or emulator.
format Format one or more Dart files.
gen-l10n Generate localizations for the current project.
pub Commands for managing Flutter packages.
run Run your Flutter app on an attached device.
test Run Flutter unit tests for the current project.
Tools & Devices
attach Attach to a running app.
custom-devices List, reset, add and delete custom devices.
daemon Run a persistent, JSON-RPC based server to communicate with devices.
debug-adapter Run a Debug Adapter Protocol (DAP) server to communicate with the Flutter tool.
devices List all connected devices.
emulators List, launch and create emulators.
install Install a Flutter app on an attached device.
logs Show log output for running Flutter apps.
screenshot Take a screenshot from a connected device.
symbolize Symbolize a stack trace from an AOT-compiled Flutter app.
Run "flutter help <command>" for more information about a command.
Run "flutter help -v" for verbose help output, including less commonly used options.
uj5u.com熱心網友回復:
以下是您可以遵循的一些步驟:-
cd .. 你的顫振專案運行flutter clean
運行你的專案 iOS 目錄Xcode
轉到首選項-> 位置并清除派生資料

然后在終端中運行 cd.. your_project_path/iOS
然后運行pod install
然后使用 Xcode 在模擬器中運行您的代碼
也許它可以解決你的問題
uj5u.com熱心網友回復:
通過運行命令將專案依賴項升級到最新版本
flutter pub upgrade
轉到專案運行的 iOS 檔案夾
pod init
和
pod install
我希望這個解決方案可以解決您的問題。
如果這個答案對你有幫助,請投票。
uj5u.com熱心網友回復:
前一小時我有同樣的錯誤
在我的情況下,解決方案是繼續這個步驟:
- Backup Runner 檔案夾
- 洗掉ios檔案夾
- 轉到終端并
flutter create .在flutter專案檔案夾中執行 - 將 Runner 檔案夾粘貼回 ios 檔案夾
pod deintegrate在 ios 檔案夾中pod install也在ios檔案夾中flutter clean在顫振專案檔案夾中flutter pub getflutter run
請注意,如果您使用 firebase,您需要重新插入 GoogleService-Info.plist 檔案
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/425796.html
下一篇:快速驗證和交換元素
