Flutter: 应用程序不是 x86_64。运行 lipo -info:,应用程序架构为:arm64。

huangapple go评论108阅读模式
英文:

Flutter: App is not x86_64. Running lipo -info:, App is architecture: arm64

问题

I built my project on a real iOS device and it was working fine but when I tried to run it on the simulator it gives me the below architecture error. Also, I have faced the same issue earlier and that time App was working fine for simulator and gave me the same error for the real device.

非 x86_64 架构的非通用二进制文件 /Users/dhavalkansara/Library/Developer/Xcode/DerivedData/Runner-dwtuugielmxutoatpwezjbbcemuy/Build/Products/Debug-iphonesimulator/Runner.app/Frameworks/App.framework/App。运行 lipo -info 命令返回:

非通用文件:/Users/dhavalkansara/Library/Developer/Xcode/DerivedData/Runner-dwtuugielmxutoatpwezjbbcemuy/Build/Products/Debug-iphonesimulator/Runner.app/Frameworks/App.framework/App 的架构为 arm64。

/bin/sh 命令执行失败,退出码为 1。

我尝试了 GitHub 上的多个解决方案 #25260, #22749, #23917,但仍然遇到相同的问题。

英文:

I built my project on a real iOS device and it was working fine but when I tried to run it on the simulator it gives me the below architecture error. Also, I have faced the same issue earlier and that time App was working fine for simulator and gave me the same error for the real device.

 Non-fat binary /Users/dhavalkansara/Library/Developer/Xcode/DerivedData/Runner-dwtuugielmxutoatpwezjbbcemuy/Build/Products/Debug-iphonesimulator/Runner.app/Frameworks/App.framework/App is not x86_64. Running lipo -info:
 Non-fat file: /Users/dhavalkansara/Library/Developer/Xcode/DerivedData/Runner-dwtuugielmxutoatpwezjbbcemuy/Build/Products/Debug-iphonesimulator/Runner.app/Frameworks/App.framework/App is architecture: arm64
 Command /bin/sh failed with exit code 1

I tried multiple solutions available #25260, #22749, #23917 on GitHub but still facing the same issue.

答案1

得分: 1

你的项目可能有一个运行脚本构建阶段,用于移除模拟器架构(以避免被AppStore拒绝)。

这个脚本通常是这个变种:http://ikennd.ac/blog/2015/02/stripping-unwanted-architectures-from-dynamic-libraries-in-xcode/

如果项目构建运行了这样的脚本,并且目标是模拟器而不是真实设备,构建可能会失败。

我的建议:找到这个脚本(在目标设置 -> 构建阶段中),并将其放入以下条件中:

if [[ "$CONFIGURATION" == "Release" ]]; then
[在这里放入原始脚本]
fi

英文:

Your project probably has a run-script build phase for removing simulator architecture (in order to avoid AppStore rejection).

This script is usually a variation of this one: http://ikennd.ac/blog/2015/02/stripping-unwanted-architectures-from-dynamic-libraries-in-xcode/

If the project build runs such a script, the build might fail when the destination is a simulator and not a real device.

My suggestion: Find this script (in Target Settings -> Build Phases) and enclose it in:

    if [[ "$CONFIGURATION" == "Release" ]]; then
    [Put original script here]
    fi

答案2

得分: 1

我不确定这个问题的实际原因。我只是从我的系统中删除了项目和Xcode的派生数据,然后重新克隆了相同的项目,然后在模拟器和真机上都正常工作。

所以根据我的经验,我认为在 release 模式下运行构建,可以使用 flutter run --release 命令或者通过更改 Xcode > Edit scheme > Run > Release 可能会导致默认项目设置发生一些变化,因此我收到了“无法为设备构建预编译应用程序”的错误消息。

我还在GitHub上提出了问题

英文:

I am not sure about the actual reason behind this issue. I just deleted the project and Xcode's derived data from my system and then recloned the same project again and it was working fine in both simulator and real device.

So as per my experience, I am assuming that while running the build in release mode using flutter run --release command or by changing Xcode > Edit scheme > Run > Release there might be some changes within the default project settings and because of that I was getting " Could not build the precompiled application for the device." this error.

I have also raised an issue on GitHub for the same.

huangapple
  • 本文由 发表于 2020年1月6日 22:03:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/59613498.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定