简体   繁体   English

M1 Mac Xcode Build Done then Failed Flutter 项目(苹果硅)

[英]M1 Mac Xcode Build Done then Failed Flutter Project (apple silicon)

I have been stuck on a problem that always occurs whenever I run any project from my M1 Mac.每当我从 M1 Mac 运行任何项目时,我都会遇到一个问题。 I have tried all the solutions from stack overflow and github.我已经尝试了堆栈溢出和 github 的所有解决方案。 I am about to lose my.我快要失去我的了。 4th project because of the hassle.第 4 个项目,因为麻烦。 First I thought it is because of flutter macOS desktop support.首先我认为这是因为 flutter macOS 桌面支持。 Disabled it, nothing changed.禁用它,没有任何改变。 When I add some dependencies to my app and use it as a widget or function the project fails.当我向我的应用程序添加一些依赖项并将其用作小部件或 function 时,项目失败。 It ruins my 4th day.它毁了我的第四天。 I am sharing all the details and kindly waiting for your help.我正在分享所有细节,并期待您的帮助。

Reproduced:转载:

  • Disabled macOS flutter desktop support禁用 macOS flutter 桌面支持
  • delete podfile.lock and restart删除 podfile.lock 并重新启动
  • In Xcode Runner/Runner disabled for builds only在 Xcode Runner/Runner 中禁用,仅用于构建
  • Install cocoapods and ffi as it is (first answer) cocoapods_ffi按原样安装 cocoapods 和 ffi(第一个答案) cocoapods_ffi
  • Changed deployment target to 9 and 10将部署目标更改为 9 和 10

flutter doctor -v; flutter 医生-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!

Error Log;错误日志;

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

Xcode_error Xcode

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

Add below code in the project pod file and run command pod install在项目 pod 文件中添加以下代码并运行命令 pod install

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结尾

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 Apple Silicon('M1')上构建 Google Analytics SDK,使其在 Xcode 模拟器中运行? - How can I build the Google Analytics SDK on Apple Silicon ('M1') so it runs in the Xcode Simulator? 带有 Xcode 12.5 的 M1 Mac 从不运行 Flutter 项目 - M1 Mac with Xcode 12.5 never runs Flutter Project Xcode 错误“为 iOS 模拟器构建,但在为 iOS.. 构建的 dylib 中链接”来自 Apple Silicon M1 Mac - Xcode error 'building for iOS Simulator, but linking in dylib built for iOS .. for architecture arm64' from Apple Silicon M1 Mac Xcode 构建完成。 无法构建 iOS 应用程序 - Flutter 项目 - Xcode build done. Failed to build iOS app - Flutter project 如何在 Apple Silicon (M1) 上运行 CocoaPods - How to run CocoaPods on Apple Silicon (M1) iOS XCode 构建错误(颤振)- 无法在带有 M1 芯片的 Mac 上为 iOS(颤振)构建 apk - iOS XCode build error (flutter) -- cannot build apk for iOS (flutter) on mac with M1 chip 有没有办法在 Apple Silicon M1 上运行 Firebase? - Is there a way to run Firebase on Apple Silicon M1? Flutter 不会在 M1 Mac 上使用 Firebase 构建在 iOS 上 - Flutter will not build on iOS with Firebase on M1 Mac 如何在 M1 Mac 中运行 flutter 项目 - how to run flutter project in M1 Mac 如果不使用 rosseta,我无法使用 Apple Silicon m1 Pro 构建我的应用程序 - I can't build my app with apple silicon m1 pro without using rosseta
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM