首页 > 解决方案 > 构建模块“nanopb”时无法构建 iOS 应用程序

问题描述

运行我的颤振应用程序时出现以下错误,我无法弄清楚为什么它一直在发生。我的所有项目都不会发生这种情况。我什至创建了一个新项目,只将 dart 文件移动到新项目中,它又发生了,我不知道为什么。我认为这与 podfile 有关。

Launching lib/main.dart on iPhone 8 in debug mode...
lib/main.dart:1
Xcode build done.                                           12,8s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **
Xcode's output:
↳
    While building module 'nanopb' imported from /Users/Admin/Documents/GitHub/SURFAPP_V3/surf_app_v3/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.h:22:
    In file included from <module-includes>:1:

  /Users/Admin/Documents/GitHub/SURFAPP_V3/surf_app_v3/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:13:9: error: double-quoted include "pb.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]
#import "pb.h"
        ^~~~~~
        <pb.h>
/Users/Admin/Documents/GitHub/SURFAPP_V3/surf_app_v3/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:14:9: error: double-quoted include "pb_common.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]
#import "pb_common.h"
        ^~~~~~~~~~~~~
        <pb_common.h>
While building module 'nanopb' imported from /Users/Admin/Documents/GitHub/SURFAPP_V3/surf_app_v3/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.h:22:
In file included from <module-includes>:1:
In file included from /Users/Admin/Documents/GitHub/SURFAPP_V3/surf_app_v3/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:14:
/Users/Admin/Documents/GitHub/SURFAPP_V3/surf_app_v3/ios/Pods/nanopb/pb_common.h:8:10: error: double-quoted include "pb.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]
#include "pb.h"
         ^~~~~~
         <pb.h>
While building module 'nanopb' imported from /Users/Admin/Documents/GitHub/SURFAPP_V3/surf_app_v3/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.h:22:
In file included from <module-includes>:1:
/Users/Admin/Documents/GitHub/SURFAPP_V3/surf_app_v3/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:15:9: error: double-quoted include "pb_decode.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]
#import "pb_decode.h"
        ^~~~~~~~~~~~~
        <pb_decode.h>
While building module 'nanopb' imported from /Users/Admin/Documents/GitHub/SURFAPP_V3/surf_app_v3/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.h:22:
In file included from <module-includes>:1:
In file included from /Users/Admin/Documents/GitHub/SURFAPP_V3/surf_app_v3/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:15:
/Users/Admin/Documents/GitHub/SURFAPP_V3/surf_app_v3/ios/Pods/nanopb/pb_decode.h:9:10: error: double-quoted include "pb.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]
#include "pb.h"
         ^~~~~~
         <pb.h>
While building module 'nanopb' imported from /Users/Admin/Documents/GitHub/SURFAPP_V3/surf_app_v3/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.h:22:
In file included from <module-includes>:1:
/Users/Admin/Documents/GitHub/SURFAPP_V3/surf_app_v3/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:16:9: error: double-quoted include "pb_encode.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]
#import "pb_encode.h"
        ^~~~~~~~~~~~~
        <pb_encode.h>

  While building module 'nanopb' imported from /Users/Admin/Documents/GitHub/SURFAPP_V3/surf_app_v3/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.h:22:
In file included from <module-includes>:1:
In file included from /Users/Admin/Documents/GitHub/SURFAPP_V3/surf_app_v3/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:16:
/Users/Admin/Documents/GitHub/SURFAPP_V3/surf_app_v3/ios/Pods/nanopb/pb_encode.h:9:10: error: double-quoted include "pb.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]
#include "pb.h"
         ^~~~~~
         <pb.h>
While building module 'nanopb' imported from /Users/Admin/Documents/GitHub/SURFAPP_V3/surf_app_v3/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.h:22:
In file included from <module-includes>:1:
/Users/Admin/Documents/GitHub/SURFAPP_V3/surf_app_v3/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:17:9: error: double-quoted include "pb.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]
#import "pb.h"
        ^~~~~~
        <pb.h>
/Users/Admin/Documents/GitHub/SURFAPP_V3/surf_app_v3/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:18:9: error: double-quoted include "pb_decode.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]
#import "pb_decode.h"
        ^~~~~~~~~~~~~
        <pb_decode.h>
/Users/Admin/Documents/GitHub/SURFAPP_V3/surf_app_v3/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:19:9: error: double-quoted include "pb_common.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]
#import "pb_common.h"
        ^~~~~~~~~~~~~
        <pb_common.h>
/Users/Admin/Documents/GitHub/SURFAPP_V3/surf_app_v3/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:20:9: error: double-quoted include "pb.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]
#import "pb.h"
        ^~~~~~
        <pb.h>
/Users/Admin/Documents/GitHub/SURFAPP_V3/surf_app_v3/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:21:9: error: double-quoted include "pb_encode.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]
#import "pb_encode.h"
        ^~~~~~~~~~~~~
        <pb_encode.h>
/Users/Admin/Documents/GitHub/SURFAPP_V3/surf_app_v3/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:22:9: error: double-quoted include "pb_common.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]
#import "pb_common.h"
        ^~~~~~~~~~~~~
        <pb_common.h>

    13 errors generated.
In file included from /Users/Admin/Documents/GitHub/SURFAPP_V3/surf_app_v3/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.c:20:
/Users/Admin/Documents/GitHub/SURFAPP_V3/surf_app_v3/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.h:22:10: fatal error: could not build module 'nanopb'
#include <nanopb/pb.h>
 ~~~~~~~~^
14 errors generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.2.99. (in target 'Toast' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.2.99. (in target 'nanopb' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.2.99. (in target 'fluttertoast' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.2.99. (in target 'GoogleDataTransport' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.2.99. (in target 'FirebaseMessaging' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.2.99. (in target 'FirebaseInstallations' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.2.99. (in target 'FirebaseCoreDiagnostics' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.2.99. (in target 'firebase_core' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.2.99. (in target 'GoogleUtilities' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.2.99. (in target 'Flutter' from project 'Pods')
warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the Runner editor. (in target 'Runner' from project 'Runner')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.2.99. (in target 'firebase_messaging' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.2.99. (in target 'FirebaseInstanceID' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.2.99. (in target 'Firebase' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.2.99. (in target 'FirebaseCore' from project 'Pods')
Could not build the application for the simulator.
Error launching application on iPhone 8.
Exited (sigterm)

这是我的 ios/Podfile

   # Uncomment this line to define a global platform for your project
# 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 flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

我的 pubsec.yaml

    name: surf_app_v3
description: A new Flutter project.

# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  http: ^0.12.0+2
  fluttertoast: ^7.1.6
  intl: ^0.16.0
  uuid: ^2.2.2
  flutter_google_places: ^0.2.6
  firebase_messaging: ^7.0.3


  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.0

dev_dependencies:
  flutter_test:
    sdk: flutter

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  # assets:
  #   - images/a_dot_burr.jpeg
  #   - images/a_dot_ham.jpeg

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

标签: flutterdart

解决方案


推荐阅读