gpt4 book ai didi

How to see logs in release mode?(如何在发布模式下查看日志?)

转载 作者:bug小助手 更新时间:2023-10-25 19:26:41 28 4
gpt4 key购买 nike



I need to see the logs in release mode. But I'm not able to see any output when I run the app with the command: flutter run --release.

我需要查看发布模式下的日志。但当我使用以下命令运行应用程序时,我看不到任何输出:Ffltter Run--Release。


How can I see the logs when app is running in the release mode?

APP在发布模式下运行时,如何查看日志?


更多回答
优秀答案推荐

Open Android Studio with a dummy Android project (not Flutter). You'll find the Logcat pane on the bottom. That shows all the logs of all the apps running on your device. Filter by "flutter" and you should see logs of all Flutter apps running on that device.

用一个虚拟的Android项目(而不是Ffltter)打开Android Studio。您将在底部找到Logcat窗格。这会显示你的设备上运行的所有应用程序的所有日志。你应该会看到该设备上运行的所有颤动应用程序的日志。


A nice trick is, right before you do something interesting (launching the app, entering the risky page, doing whatever that creates the logs that you are looking for), clear the Logcat output and do that thing with the app to generate the log lines. Then scroll all the way up and find the logs that you were interested in. Sometimes Android exceptions may not show up with "flutter" in them and I found this technique to be very useful.

一个很好的诀窍是,在你做一些有趣的事情之前(启动应用程序,进入有风险的页面,做任何创建你想要的日志的事情),清除Logcat输出,然后用应用程序来生成日志行。然后一直向上滚动,找到您感兴趣的日志。有时候,Android的异常可能不会显示出“fltter”,我发现这项技术非常有用。


For iOS, the device console is what you are looking for: https://developer.apple.com/forums/thread/64123

对于iOS,设备控制台就是你想要的:https://developer.apple.com/forums/thread/64123



Use print() or debugPrint().

使用print()或debugPrint()。



You have two options for logging for your application. The first is to use stdout and stderr. Generally, this is done using print() statements, or by importing dart:io and invoking methods on stderr and stdout.




If you output too much at once, then Android sometimes discards some log lines. To avoid this, use debugPrint(), from Flutter’s foundation library.



Check Debugging Flutter apps programmatically for more info.

有关更多信息,请查看以编程方式调试颤动应用程序。


The log tag will be "flutter" by the way.

顺便说一句,原木标签将会“摆动”。



To verify the list of all accessible devices, execute the command below

要验证所有可访问设备的列表,请执行以下命令


flutter devices

颤振装置


Afterward, use the following command to launch the application in release mode along with the logs:

然后,使用以下命令在发布模式下启动应用程序和日志:


flutter run -d yourDeviceId --release

颤动运行-d您的设备ID--释放


You can easily use the Logcat of Android to see the logs in release mode with this way

通过这种方式,您可以很容易地使用Android的Logcat在发布模式下查看日志


更多回答

Çok teşekkürler. Aradığım şey tam olarak buydu. :)

şEkkürler先生。Aradığımşey tam olarak buydu.:)

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