Mac环境下的android studio在编译flutter项目时,安卓手机可以正常编译打包,但是苹果虚拟机在Xcode build时就会报错,不过经过我测试有的项目又可以编译运行,所以排除了环境安装的问题,网上找了好多方法但都不行,请教一下各位同志们,是不是Xcode还有什么配置要更改,或者是iOS文件里面有什么东西要删除。
android studio日志:
Launching lib/main.dart on iPhone 8 Plus in debug mode...
Running pod install...
Running Xcode build...
Xcode build done. 22.3s
Failed to build iOS app
Error (Xcode): Target debug_ios_bundle_flutter_assets failed: Exception: Failed to codesign /Users/apple/FlutterProjects/bms_flutter/build/ios/Debug-iphonesimulator/App.framework/App with identity -.
Could not build the application for the simulator.
Error launching application on iPhone 8 Plus.
Xcode日志:
Target debug_ios_bundle_flutter_assets failed: Exception: Failed to codesign /Users/apple/Library/Developer/Xcode/DerivedData/Runner-bofzxcajanrxjxawfrrbhdmhyuce/Build/Products/Debug-iphonesimulator/App.framework/App with identity -.
flutter版本:
Flutter 3.7.7 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 2ad6cd72c0 (13 days ago) • 2023-03-08 09:41:59 -0800
Engine • revision 1837b5be5f
Tools • Dart 2.19.4 • DevTools 2.20.1
flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.7, on macOS 13.2.1 22D68 darwin-x64, locale
zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.1)
[✓] Connected device (4 available)
[✓] HTTP Host Availability
我怀疑和下面这两个文件有关,但是有这个文件的也编译成功了;
profile.lock内容:
PODS:
- device_info_plus (0.0.1):
- Flutter
- disk_space (0.0.1):
- Flutter
- Flutter (1.0.0)
- flutter_blue_plus (0.0.1):
- Flutter
- flutter_blue_plus/Protos (= 0.0.1)
- flutter_blue_plus/Protos (0.0.1):
- Flutter
- Protobuf (~> 3.11)
- FMDB (2.7.5):
- FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5)
- package_info_plus (0.4.5):
- Flutter
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- Protobuf (3.21.1)
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- sqflite (0.0.2):
- Flutter
- FMDB (>= 2.7.5)
- webview_flutter_wkwebview (0.0.1):
- Flutter
DEPENDENCIES:
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- disk_space (from `.symlinks/plugins/disk_space/ios`)
- Flutter (from `Flutter`)
- flutter_blue_plus (from `.symlinks/plugins/flutter_blue_plus/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`)
SPEC REPOS:
https://github.com/CocoaPods/Specs.git:
- FMDB
- Protobuf
EXTERNAL SOURCES:
device_info_plus:
:path: ".symlinks/plugins/device_info_plus/ios"
disk_space:
:path: ".symlinks/plugins/disk_space/ios"
Flutter:
:path: Flutter
flutter_blue_plus:
:path: ".symlinks/plugins/flutter_blue_plus/ios"
package_info_plus:
:path: ".symlinks/plugins/package_info_plus/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/ios"
sqflite:
:path: ".symlinks/plugins/sqflite/ios"
webview_flutter_wkwebview:
:path: ".symlinks/plugins/webview_flutter_wkwebview/ios"
SPEC CHECKSUMS:
device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed
disk_space: e94d34bbdf77954adfb39e60bde9cc5c7233eda6
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_blue_plus: 6787777145d615de01828f3a9fa423c3c702f0b3
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852
Protobuf: 9e88c1e667d75aa2491d211f26ccddde4e8ad4cf
shared_preferences_foundation: 297b3ebca31b34ec92be11acd7fb0ba932c822ca
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
webview_flutter_wkwebview: b7e70ef1ddded7e69c796c7390ee74180182971f
PODFILE CHECKSUM: d4b3474092930fbb95bf2a0d04d10ef405cb59af
COCOAPODS: 1.12.0
podfile内容:
Last login: Wed Mar 22 10:53:33 on ttys002
apple@DbayMacBook-Pro ~ % /Users/apple/FlutterProjects/bms_flutter/ios/Podfile ; exit;
/Users/apple/FlutterProjects/bms_flutter/ios/Podfile: line 2: platform: command not found
/Users/apple/FlutterProjects/bms_flutter/ios/Podfile: line 6: https://github.com/CocoaPods/Specs.git: No such file or directory
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
[进程已完成]