Flutter:该应用程序不是为 iOS 构建的
Posted
技术标签:
【中文标题】Flutter:该应用程序不是为 iOS 构建的【英文标题】:Flutter: The app doesn't get built for iOS 【发布时间】:2019-11-18 11:55:45 【问题描述】:我的应用无法为 ios 构建,但在 android 上运行良好。 Flutter clean 或 pod install 命令没有帮助。
复制步骤
flutter build ios
日志
并附上所有 在带有反引号的行之间记录输出。如果有一个 异常,请查看错误信息是否包含足够的信息 解释如何解决问题。 -->
Encountered error while building for device.
Elliots-Mac-mini:club_lime elliot_thm$ flutter clean
Deleting 'build/'.
Deleting '/Users/elliot_thm/Documents/club_lime/.dart_tool/'.
Elliots-Mac-mini:club_lime elliot_thm$ flutter build ios
Building com.vivaleasure.clubLime for device (ios-release)...
Automatically signing iOS for device deployment using specified development team in Xcode project: 6NDB4SY6HS
Running pod install... 1.1s
Running Xcode build...
├─Building Dart code... 34.7s
├─Generating dSYM file... 0.3s
├─Stripping debug symbols... 0.0s
├─Assembling Flutter resources... 1.2s
└─Compiling, linking and signing... 1.7s
Xcode build done. 39.0s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Release ===
2019-07-08 12:13:10.058 defaults[26804:842682]
The domain/default pair of (/Users/elliot_thm/Documents/club_lime/build/ios/Release-iphoneos/Runner.app/Frameworks/App.framework/flutter_assets/ios/Flutter/App%202.framework/Info.plist, CFBundleExecutable)
does not exist
fatal error: lipo: can't map input file: /Users/elliot_thm/Documents/club_lime/build/ios/Release-iphoneos/Runner.app/Frameworks/App.framework/flutter_assets/ios/Flutter/App%202.framework/ (Invalid argument)
fatal error: lipo: can't map input file: /Users/elliot_thm/Documents/club_lime/build/ios/Release-iphoneos/Runner.app/Frameworks/App.framework/flutter_assets/ios/Flutter/App%202.framework/ (Invalid argument)
Failed to extract arm64 for /Users/elliot_thm/Documents/club_lime/build/ios/Release-iphoneos/Runner.app/Frameworks/App.framework/flutter_assets/ios/Flutter/App%202.framework/. Running lipo -info:
fatal error: lipo: can't map input file: /Users/elliot_thm/Documents/club_lime/build/ios/Release-iphoneos/Runner.app/Frameworks/App.framework/flutter_assets/ios/Flutter/App%202.framework/ (Invalid argument)
flutter analyze
Analyzing club_lime...
No issues found! (ran in 2.5s)
flutter doctor -v
[✓] Flutter (Channel stable, v1.5.4-hotfix.2, on Mac OS X 10.14.5 18F132, locale en-AU)
• Flutter version 1.5.4-hotfix.2 at /Users/elliot_thm/flutter
• Framework revision 7a4c33425d (10 weeks ago), 2019-04-29 11:05:24 -0700
• Engine revision 52c7a1e849
• Dart version 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
• Android SDK at /Users/elliot_thm/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.
[✓] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.2.1, Build version 10E1001
• ios-deploy 1.9.4
• CocoaPods version 1.7.2
[!] Android Studio (version 3.4)
• Android Studio at /Applications/Android Studio.app/Contents
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[✓] VS Code (version 1.36.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.2.0
[✓] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator)
! Doctor found issues in 1 category.
【问题讨论】:
【参考方案1】:首先备份您现有的 ios 文件夹。 删除并运行
flutter create .
它将生成 ios 文件夹。 构建并运行,您应该一切顺利。
【讨论】:
这太棒了。非常感谢!【参考方案2】:最后我能够通过使用创建一个新项目来解决问题
flutter create -i swift -a kotlin project_name
并将 lib 文件夹移动到那里,而不对 dart 代码进行任何更改。
【讨论】:
但在我看来,这无论如何都不是解决方案。如果有人已经有生产应用程序,那么几乎不可能执行此解决方案..因为密钥,签名应用程序...... 我后来发现原来的问题是由于将项目目录放入启用了 iCloud 的文件夹中造成的。出于某种原因,它会在 Flutter 目录中创建新文件夹。删除这些文件夹(名为 Flutter 2、Flutter 3...)即可解决问题。【参考方案3】:我遇到了同样的问题。通过清除构建文件夹来修复
【讨论】:
【参考方案4】:请注意,这个问题似乎是当前 Flutter 版本中的一个错误 (1.20.2 bbfbf17
)。
它似乎已在 dev 频道的最新 Flutter 版本中修复。
所以如果你可以使用开发频道:
flutter channel dev
flutter upgrade --force
flutter build ios
使用开发频道为我修复了它。
这可能是 1.20.3 中的 hotfixed
从 14.08.2020 发表评论:
修复 #61129 不适用于 1.20 稳定版频道。它是 在 1.21.0-1.0.pre 中可用,目前是开发通道。它是 正在评估 1.20 稳定的修补程序。如果你仍然看到这个 1.21.0-1.0.pre 或更高版本中的问题,请提交新问题并 完整填写模板,以便我们进行调查。
查看1.20.3
的精选:https://github.com/flutter/flutter/pull/64984
编辑:
这个问题似乎已经解决了。查看发布日志:
https://github.com/flutter/flutter/releases/tag/1.20.3
使用flutter upgrade
将解决此问题。
【讨论】:
【参考方案5】:就我而言,我需要检查构建标志:
【讨论】:
【参考方案6】:flutter create -i swift -a kotlin project_name
cd project_name
flutter run
【讨论】:
以上是关于Flutter:该应用程序不是为 iOS 构建的的主要内容,如果未能解决你的问题,请参考以下文章
Flutter android未构建版本,移至新机器后出现key.jks问题[关闭]
IOS 的 Flutter 应用程序,是不是可以在没有 Xcode 的情况下设置 IOS“旧版构建系统”?