M1 Mac Xcode 构建完成但 Flutter 项目失败(苹果芯片)

2024-04-17

我一直遇到一个问题,每当我从 M1 Mac 运行任何项目时,总会出现这个问题。 我已经尝试了来自stackoverflow和github的所有解决方案。我快要失去我的了。由于麻烦,第四个项目。 首先我以为是因为 flutter macOS 桌面支持。禁用它,没有任何改变。 当我向应用程序添加一些依赖项并将其用作小部件或函数时,项目失败。 这毁了我的第四天。我正在分享所有详细信息,并真诚地等待您的帮助。

转载:

  • 禁用 macOS flutter 桌面支持
  • 删除podfile.lock并重启
  • 在 Xcode Runner/Runner 中,仅针对构建禁用
  • 按原样安装 cocoapods 和 ffi (第一个答案)cocoapods_ffi https://stackoverflow.com/questions/66594590/flutter-project-failing-to-build-on-mac-m1
  • 将部署目标更改为 9 和 10

颤振医生-v;

alperenbaskaya@Alperen-MacBook-Air ios % flutter doctor -v
[✓] Flutter (Channel stable, 2.0.1, on macOS 11.2.1 20D74 darwin-arm, locale tr-TR)
    • Flutter version 2.0.1 at /Users/alperenbaskaya/Desktop/flutter
    • Framework revision c5a4b4029c (3 months ago), 2021-03-04 09:47:48 -0800
    • Engine revision 40441def69
    • Dart version 2.12.0

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/alperenbaskaya/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5, Build version 12E262
    • CocoaPods version 1.10.1

[✓] Android Studio (version 4.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 1.8.0_242-release-1644-b3-6915495)

[✓] Connected device (1 available)
    • iPhone 11 Pro (mobile) • 8E932E0F-46C9-42FC-AA28-06DBA7A513D6 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)

• No issues found!

错误日志;

Failed to build iOS app
Error output from Xcode build:
↳
    objc[89556]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x1eb708188) and ?? (0x115c482b8). One of the two will be used. Which one is undefined.
    objc[89556]: Class AMSupportURLSession is implemented in both ?? (0x1eb7081d8) and ?? (0x115c48308). One of the two will be used. Which one is undefined.
    ** BUILD FAILED **


Xcode's output:
↳
    abseil-dfbvnbqkknxxbhdudyeskahnmgpi
    building file list ... rsync: link_stat "/Users/alperenbaskaya/AndroidStudioProjects/app_app/build/ios/Debug-iphonesimulator/App.framework" failed: No such file or directory (2)
    done

    sent 29 bytes  received 20 bytes  98.00 bytes/sec
    total size is 0  speedup is 0.00
    rsync error: some files could not be transferred (code 23) at /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-55/rsync/main.c(996) [sender=2.6.9]
    Command PhaseScriptExecution failed with a nonzero exit code
    abseil-dfbvnbqkknxxbhdudyeskahnmgpi
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Analyzing workspace
    note: Constructing build description
    note: Build preparation complete
    note: Removed stale file '/Users/alperenbaskaya/Library/Developer/Xcode/DerivedData/Runner-diukrbptujoetdfkyqoxkpqvirsd/Build/Products/Debug-iphonesimulator/sqflite/sqflite.framework'

pod;

# Uncomment this line to define a global platform for your project
platform :ios, '10.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'false'
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

Edit:

note: Using new build system
note: Building targets in parallel
note: Planning build
note: Analyzing workspace
note: Constructing build description
note: Build preparation complete

在项目pod文件中添加以下代码并运行命令 吊舱安装

post_install do |installer|
installer.pods_project.targets.each do |target|
  target.build_configurations.each do |config|
    flutter_additional_ios_build_settings(target)
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
    config.build_settings["ONLY_ACTIVE_ARCH"] = "YES"
  end
end

end

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

M1 Mac Xcode 构建完成但 Flutter 项目失败(苹果芯片) 的相关文章

  • 应用程序图标未刷新

    我更改了新版本应用程序中的图标图像 并且我在设备中安装了旧版本应用程序 然后我安装了新版本 它在 iOS 5 中运行良好 但在 iOS 6 中 图标没有刷新 它仍然显示旧版本图标 徽标 如果没有安装旧版本应用程序 该设备在 iOS 5 和
  • 在 _WidgetsAppState 中找不到路由 RouteSettings("/", null) 的生成器

    我正在写一个Flutter应用程序 这里有点初学者 这是我的代码 main dart import package flutter material dart import package flutter app timer helpers
  • 解析用户周围的位置

    您好 我开发了一个应用程序 我想问一个问题 在我的数据云解析中 我有 餐馆 类 我有三列 名称 类型字符串 imageFile 类型文件 description 类型数组和 Location 类型GeoPoint 我想知道使用哪种方法来获取
  • iOS Swift 检测键盘事件

    我能以某种方式检测来自 iOS 键盘的事件吗 我想检测此类事件UIViewController哪个没有UITextField或任何此类物体 我只有四个圆圈UIView我想在按下键盘上的按钮时将它们涂成不同的颜色 您没有任何对象可以从键盘获取
  • Flutter - TextPainter 与 Paragraph 绘制书页

    我需要显示长文本 这将占用几个屏幕 页面 我还必须添加一些功能 所以我想实现我自己的文本显示组件 我找到了与此任务相对应的两个类 文本绘制器 use TextSpan对于文本 use 油漆 画布 胶印 用于绘画 段落使用 队列 作为文本和样
  • 如何向 JSQMessagesViewController 单元添加自定义视图,使其包含一个带有一些按钮和文本视图的视图?

    我在用https github com jessesquires JSQMessagesViewController issues 1820 https github com jessesquires JSQMessagesViewCont
  • iOS 4.2.1 丢失文件?

    这是我第一次使用最新的 xcode 3 2 5 和新的 iOS 4 2 1 当我在设备上运行应用程序时 我收到以下运行时错误 无法读取 Developer Platforms iPhoneOS platform DeviceSupport
  • 使用 UIActionSheet 更改视图时工具栏项目消失

    当从 a 启动视图时UIActionSheet按钮 通过导航栏后退按钮返回视图后 工具栏虽然仍然可见 但上面没有任何以前的按钮 自从更新到 iOS 6 以来 这个错误就出现了 并且是在模拟器和仅运行 iOS 6 的设备上测试时发生的 如果我
  • iOS App布局错误,调用状态栏

    在主动通话和应用程序布局期间面临状态栏问题 我正在使用自动布局 当我运行应用程序 然后开始通话时 一切正常 UI 会随着状态栏的更改而正确缩放 但是 如果我首先开始通话 然后运行应用程序 应用程序屏幕会移动到底部 20pt 就像它们对新状态
  • 使用 UIImagePickerController 的应用程序在拍照后选择“使用照片”时冻结

    我现在正在开发一个简单的照片和视频捕获应用程序 该应用程序成功地允许用户按下按钮即可拍摄照片或视频 但是 一旦您完成拍摄照片或视频 它就会提供 2 个选项 重新拍摄 和 使用照片 或 使用视频 具体取决于您使用的选项 如果用户点击 重新拍摄
  • 对 UIImage 进行方形裁剪,导致图像拉伸

    当尝试执行 UIImage 的中心裁剪时 我得到以下结果 左侧是原始图像640 1136 右边是适合正方形的裁剪图像UIImageView at 320 320 turns to 我对比率元素进行了相当多的修改 以便它可以正确检测要修剪的量
  • iOS:从非图像数据生成图像(Godus,如风景)

    所以看到图像后Godus http www kickstarter com projects 22cans project godus我想知道如何生成简单的 非交互式的 2D 图像 with 不同高度或层数的颜色不同就像下面的图片一样 我只
  • Swift:从自定义 UITableViewCell 中的 UITextField 检索文本并将其放入数组中

    我正在制作一个非常简单的应用程序 用户在第一个屏幕中输入人数 在第二个屏幕中 它会生成一些UITableViewCell基于用户在第一个屏幕中输入的数字 这UITableViewCell have a UITextField在其中 一旦用户
  • iOS 中的等宽字体是什么?

    我想要在我的 iOS 应用程序中为 UILabel 使用等宽字体 不幸的是 我找不到一个 甚至 美国打字机 实际上也不是等宽的 XCode 中可用的等宽字体是什么 iOS 等宽字体 Courier Courier Bold Courier
  • 更改 UITextField 辅助功能描述

    有没有办法将 UITextField 的辅助功能标签设置为 文本字段 之外的其他内容 因此 我不想将其称为 文本字段 而是将其命名为 代码验证字段 我的建议是不要试图在内置语音输出上智取系统 对于盲人用户来说 文本字段正在编辑 相当于 该项
  • 如何将十六进制数组转换为 UIImage?

    有几个与使用 P25mi 动态打印图像相关的未解答问题 没有一个得到公认的答案 下面有几个链接 如何将图像转换为位图代码以便在 iPhone 中进行蓝牙打印 https stackoverflow com questions 1383828
  • Firebase Cloud Function:& Flutter:无法在模拟器上使用 https 可调用函数 [firebase_functions/unavailable] 不可用

    我试图从我的 flutter 应用程序中使用模拟器调用 HTTPS 可调用函数 但它似乎不起作用 我调用该函数后 总是需要大约 5 秒的时间并返回错误 如果我将该功能部署在服务器上 它就可以完全正常工作 这是我的功能 exports try
  • Flutter / FireStore:如何在 Flutter 中显示 Firestore 中的图像?

    我想将我在应用程序中使用的一些图像放入 Firestore 并从那里显示它们 而不是将它们作为资产捆绑在我的应用程序中 为了做到这一点 我想出了以下解决方案 对于我想要显示图像的项目 我创建了一个 Firebase 文档 其中有一个字段存储
  • 如何在 Xcode 4 中通过一个操作归档多个目标

    我有一个包含多个目标的项目 这些目标都适用于不同的 iOS 应用程序 例如 一个用于精简版的目标 另一个用于专业版的目标 我想立即构建并归档我的所有应用程序 目前 我对每个目标都有一个方案 我用它来独立归档每个应用程序 但现在我必须开始归档
  • 通用类不会将委托调用转发给具体子类

    鉴于以下情况 protocol EntityType var displayString String get extension String EntityType var displayString String return self

随机推荐