如何在flutter中构建没有key的release模式——Flutter调试模式好慢
How to build a release mode without a key in flutter - Flutter debug mode is so slow
每当我尝试使用 flutter run
命令测试我的应用程序时,它都非常缓慢和缓慢,我无法确定我的 应用程序性能 在发布模式下如何。然而,为了在 release mode
中为 android 构建应用程序,我们需要为该应用程序制作一个密钥,它不会显示大部分 日志文件 和 打印.
所以问题是,有什么方法可以 运行 发布模式格式但具有调试功能的应用程序吗?
简答:
flutter中有3种不同的构建模式:
调试
:这是我们经常测试应用程序的最常见模式。如果您使用的是 Android Studio,您可以在顶部面板上找到它的按钮(绿色播放按钮)。
flutter run
发布
: 此模式用于在市场上部署应用程序。
注意:此模式需要为android释放模式生成的密钥。
flutter run --release
简介
: 这就是您正在寻找的模式。在分析模式下,保留了一些调试能力——足以分析您的应用程序的性能,并且它具有与发布模式相同的性能。
flutter run --profile
长答案:
- 调试:
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 this
mode. Android Studio, for example, provides a Run > Debug… menu
option, as well as a green bug icon overlayed with a small triangle on
the project page.
- 发布:
Use release mode for deploying the app, when you want maximum
optimization 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.
- 简介:
In profile mode, some debugging ability is maintained—enough to
profile your app’s performance. Profile mode is disabled on the
emulator and simulator, because their behavior is not representative
of real performance. On mobile, profile mode is similar to release
mode, 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 运行 --release
谢谢
每当我尝试使用 flutter run
命令测试我的应用程序时,它都非常缓慢和缓慢,我无法确定我的 应用程序性能 在发布模式下如何。然而,为了在 release mode
中为 android 构建应用程序,我们需要为该应用程序制作一个密钥,它不会显示大部分 日志文件 和 打印.
所以问题是,有什么方法可以 运行 发布模式格式但具有调试功能的应用程序吗?
简答:
flutter中有3种不同的构建模式:
调试 :这是我们经常测试应用程序的最常见模式。如果您使用的是 Android Studio,您可以在顶部面板上找到它的按钮(绿色播放按钮)。
flutter run
发布 : 此模式用于在市场上部署应用程序。
注意:此模式需要为android释放模式生成的密钥。
flutter run --release
简介 : 这就是您正在寻找的模式。在分析模式下,保留了一些调试能力——足以分析您的应用程序的性能,并且它具有与发布模式相同的性能。
flutter run --profile
长答案:
- 调试:
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 this mode. Android Studio, for example, provides a Run > Debug… menu option, as well as a green bug icon overlayed with a small triangle on the project page.
- 发布:
Use release mode for deploying the app, when you want maximum optimization 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.
- 简介:
In profile mode, some debugging ability is maintained—enough to profile your app’s performance. Profile mode is disabled on the emulator and simulator, because their behavior is not representative of real performance. On mobile, profile mode is similar to release mode, 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 运行 --release
谢谢