Flutter释放构建立即崩溃而没有记录任何错误(ios)

发布于 2025-02-08 04:22:19 字数 3093 浏览 1 评论 0原文

我不确定如何重现这个问题,因为我不知道是什么原因导致了这个问题。我目前有一个正在调试模式和配置文件模式下工作的应用程序,但是我无法为发布模式构建它。我正在通过电缆直接安装到正在运行iOS 14.8的物理iPhone(而不是模拟器)上。我不拥有Android设备,因此我不确定Android构建是否也会发生此问题。我尝试删除我的豆荚文件夹,podfile,podfile.lock更新可可录和运行flutter Clean,但问题仍然存在。我从提供的模板中创建了一个新的颤音项目,并遇到了相同的问题:我可以在调试模式和配置文件模式下构建,但不要发布模式。下面的日志文件是针对Barebones项目的,因为它的混乱量较小。

扑动医生输出:

[✓] Flutter (Channel stable, 3.0.2, on macOS 11.4 20F71 darwin-x64, locale en-US)
    • Flutter version 3.0.2 at /Users/aaron/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision cd41fdd495 (8 days ago), 2022-06-08 09:52:13 -0700
    • Engine revision f15f824b57
    • Dart version 2.17.3
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/aaron/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Library/Java/JavaVirtualMachines/jdk-18.0.1.1.jdk/Contents/Home/bin/java
    • Java version Java(TM) SE Runtime Environment (build 18.0.1.1+2-6)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Users/aaron/Downloads/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.3

[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).

[✓] Connected device (3 available)
    • אהרן iPhone (mobile) • 00008020-001A74AA01F9002E            • ios        • iOS 14.8 18H17
    • iPhone 13 (mobile)   • DBEAE20E-D3D1-43B5-BC15-CC8D20753EEB • ios        • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
    • macOS (desktop)      • macos                                • darwin-x64 • macOS 11.4 20F71 darwin-x64

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 2 categories.

这是我的构建日志(flutter run - release -verbose

https: //pastebin.com/f4qd1txu

如果您导航到末端,则可以看到它成功地将其部署到我的设备。日志中没有反映的是,启动时会有一个简短的白屏,应用程序崩溃。此时,我点击“ Q”以结束终端会话,并记录了“应用程序完成”。当应用程序崩溃时,没有任何错误或例外记录,这使我对如何查明问题毫无头绪。只是为了重申,可以在调试模式和配置文件模式下安装和使用无问题的应用程序。只有在发布模式下发生这种情况。

我希望我能提供更多信息,但我不知道在哪里可以解决此问题。

编辑:

我在Xcode中注意到了这一点,我以前从未注意到。

2022-06-16 15:32:44.889467-0500 Runner[68916:5583414] Metal API Validation Enabled
2022-06-16 15:32:45.053915-0500 Runner[68916:5583414] [VERBOSE-3:dart_vm_initializer.cc(22)] Error while initializing the Dart VM: Flag dedup_instructions is false in snapshot, but dedup_instructions is always true in product mode

在XCode中运行配置文件或调试构建工作,而没有此错误。也许这是释放模式中的根本原因。仍在寻求有关如何解决这个问题的答案。

I am not totally sure how to reproduce this issue as I do not know what causes this issue. I currently have an app that is working in debug mode and profile mode, but I am unable to build it for release mode. I am installing it directly via cable to a physical iPhone (not an emulator) that is running iOS 14.8. I do not own an Android device, so I am unsure if this issue happens for Android builds too. I have tried removing my Pods folder, Podfile, Podfile.lock updating Cocoapods, and running flutter clean but the issue persists. I created a new flutter project from a provided template and have the same issue: I can build in debug mode and profile mode but not release mode. The log file below is for the barebones project as it has less clutter.

Flutter doctor output:

[✓] Flutter (Channel stable, 3.0.2, on macOS 11.4 20F71 darwin-x64, locale en-US)
    • Flutter version 3.0.2 at /Users/aaron/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision cd41fdd495 (8 days ago), 2022-06-08 09:52:13 -0700
    • Engine revision f15f824b57
    • Dart version 2.17.3
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/aaron/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Library/Java/JavaVirtualMachines/jdk-18.0.1.1.jdk/Contents/Home/bin/java
    • Java version Java(TM) SE Runtime Environment (build 18.0.1.1+2-6)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Users/aaron/Downloads/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.3

[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).

[✓] Connected device (3 available)
    • אהרן iPhone (mobile) • 00008020-001A74AA01F9002E            • ios        • iOS 14.8 18H17
    • iPhone 13 (mobile)   • DBEAE20E-D3D1-43B5-BC15-CC8D20753EEB • ios        • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
    • macOS (desktop)      • macos                                • darwin-x64 • macOS 11.4 20F71 darwin-x64

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 2 categories.

Here is my build log (flutter run --release --verbose)

https://pastebin.com/f4QD1tXU

If you navigate to the end, you can see that it successfully deploys to my device. What is not reflected in the logs is that upon launching there is a brief white screen and the app crashes. At this point, I hit 'q' to end the terminal session and 'Application finished' Is logged. No errors or exceptions are logged when the app crashes, which makes me clueless on how to pinpoint the issue. Just to reiterate, the app can be installed and used without issue in debug mode and profile mode. It is only in release mode where this happens.

I wish I could provide more information, but I do not know where to begin fixing this.

Edit:

I noticed this in Xcode which I hadn't noticed before.

2022-06-16 15:32:44.889467-0500 Runner[68916:5583414] Metal API Validation Enabled
2022-06-16 15:32:45.053915-0500 Runner[68916:5583414] [VERBOSE-3:dart_vm_initializer.cc(22)] Error while initializing the Dart VM: Flag dedup_instructions is false in snapshot, but dedup_instructions is always true in product mode

Running a profile or debug build in Xcode works without this error. Perhaps this is the root cause in release mode. Still seeking answers on how to resolve this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

遗忘曾经 2025-02-15 04:22:19

如果您使用的是firebase并且未正确配置,则可能发生这种情况。或信息中没有ID的广告

This can happen if you are using firebase and is not configured properly. Or ads without Id in info plist

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文