[英]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:转载:
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
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.