gpt4 book ai didi

flutter - 如何在flutter中构建没有key的release模式——Flutter Debug模式好慢

转载 作者:行者123 更新时间:2023-12-05 04:35:09 24 4
gpt4 key购买 nike

每当我尝试使用 flutter run 命令测试我的应用程序时,它都非常缓慢和缓慢,我无法确定我的应用程序性能在 Release模式下如何。然而,为了在 release mode 下为 android 构建应用程序,我们需要为应用程序创建一个 key ,它不会显示大部分日志文件打印.

所以问题是,有没有办法以 Release模式格式运行应用程序但具有调试功能?

最佳答案

简答:

flutter 中有3 种不同的构建模式:

  1. 调试:这是我们经常测试应用程序的最常见模式。如果您使用的是 Android Studio,您可以在顶部面板上找到它的按钮(绿色播放按钮)。

    flutter run
  2. 发布: 此模式用于在市场上部署应用程序。

    注意:此模式需要为 android Release模式生成 key 。

    flutter run --release
  3. 简介: 这就是您正在寻找的模式。在分析模式下,保留了一些调试能力——足以分析您的应用程序的性能,并且它具有与 Release模式相同的性能。

    flutter run --profile

长答案:

  1. 调试:

In debug mode, the app is set up for debugging on the physical device,emulator, or simulator.

Debug mode for mobile apps mean that:

Assertions are enabled.Service extensions are enabled.Compilation is optimized for fast development and run cycles (but not for execution speed, binary size, or deployment).Debugging is enabled, and tools supporting source level debugging (such as DevTools) can connect to the process.

Debug mode for a web app means that:

The build is not minified and tree shaking has not been performed.The app is compiled with the dartdevc compiler for easier debugging.

By default, flutter run compiles to debug mode. Your IDE supports thismode. Android Studio, for example, provides a Run > Debug… menuoption, as well as a green bug icon overlayed with a small triangle onthe project page.

  1. 发布:

Use release mode for deploying the app, when you want maximumoptimization and minimal footprint size. For mobile, release mode(which is not supported on the simulator or emulator), means that:

Assertions are disabled.Debugging information is stripped out.Debugging is disabled.Compilation is optimized for fast startup, fast execution, and small package sizes.Service extensions are disabled.

Release mode for a web app means that:

The build is minified and tree shaking has been performed.The app is compiled with the dart2js compiler for best performance.

  1. 简介:

In profile mode, some debugging ability is maintained—enough toprofile your app’s performance. Profile mode is disabled on theemulator and simulator, because their behavior is not representativeof real performance. On mobile, profile mode is similar to releasemode, with the following differences:

Some service extensions, such as the one that enables the performance overlay, are enabled.Tracing is enabled, and tools supporting source-level debugging (such as DevTools) can connect to the process.

Profile mode for a web app means that:

The build is not minified but tree shaking has been performed.The app is compiled with the dart2js compiler.

您可以在 flutter 官方网站上找到文档:Flutter's build modes

关于flutter - 如何在flutter中构建没有key的release模式——Flutter Debug模式好慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71084940/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com