gpt4 book ai didi

logging - Xamarin Android - 在 Release模式下打印到应用程序输出

转载 作者:行者123 更新时间:2023-12-02 10:40:04 25 4
gpt4 key购买 nike

要修补some crash在三星和 wiko 设备上,我必须在 Release模式下在设备上运行我的应用程序。但我想在应用程序输出中看到 System.Diagnostics.Debug.WriteLine 的输出。

我已经启用了开发人员检测,并在选项中定义了 DEBUG 常量;我可以设置断点,但 WriteLine 输出仍然未显示在控制台中。 Debugging options

other debugging options

我该怎么办?

最佳答案

对于 Xamarin.Android,请使用 Android 的 Log 实用程序并监视/过滤消息的 logcat 输出。

示例:

string TAG = "StackOverflow";
Log.Info(TAG, $"This is a Info message: {DateTime.Now}");
Log.Debug(TAG, $"This is a debug message");
Log.Warn(TAG, $"Warning! Warning! Will Robinson Warning! Warning!");
Log.Error(TAG, $"Error, contact support with error code 99 for assistance");

Logcat 输出(通过命令行或 Android 设备监视器):

>adb logcat |grep StackOverflow

08-03 11:58:46.282 2338 2338 I StackOverflow: This is a Info message: 8/3/2016 11:58:46 AM
08-03 11:58:46.282 2338 2338 D StackOverflow: This is a debug message
08-03 11:58:46.282 2338 2338 W StackOverflow: Warning! Warning! Will Robinson Warning! Warning!
08-03 11:58:46.282 2338 2338 E StackOverflow: Error, contact support with error code 99 for assistance

关于logging - Xamarin Android - 在 Release模式下打印到应用程序输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38748170/

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